<template>
  <section class="main">
    <el-card style="margin-bottom:20px;">
      <div slot="header" class="clearfix">
          <span>基本信息</span>
          <div>
            <el-button type="primary" icon="el-icon-edit" @click="copymerchants()">复制</el-button>
            <el-button type="warning" icon="el-icon-edit" @click="altermerchants()">修改</el-button>
            <el-button icon="el-icon-refresh" @click="merchantdetails"></el-button>
          </div>
       </div>
       <el-descriptions   :column="4" >
         <el-descriptions-item label="商户名">{{ merchantinfo.merchantName }}</el-descriptions-item>
         <el-descriptions-item label="商户号">{{ merchantinfo.merchantNo }}</el-descriptions-item>
         <el-descriptions-item label="商户地址" :span="2">{{ merchantinfo.merchantAddress }}</el-descriptions-item>
         <el-descriptions-item label="商户简称">{{ merchantinfo.merchantShortName }}</el-descriptions-item>
         <el-descriptions-item label="注册名称">{{ merchantinfo.merchantBusinessName }}</el-descriptions-item>
         <el-descriptions-item label="一级服务商">{{ merchantinfo.agent1Name }}</el-descriptions-item>
         <el-descriptions-item label="二级服务商">{{ merchantinfo.agent2Name }}</el-descriptions-item>
         <el-descriptions-item label="业务经理">{{ merchantinfo.bdName }}</el-descriptions-item>
         <el-descriptions-item label="所属行业">{{ merchantinfo.merchantMccName }}</el-descriptions-item>
         <el-descriptions-item label="商户负责人">{{ merchantinfo.contactName }}</el-descriptions-item>
         <el-descriptions-item label="负责人电话">{{ merchantinfo.contactPhone }}</el-descriptions-item>
         <el-descriptions-item label="负责人邮箱">{{ merchantinfo.contactEmail }}</el-descriptions-item>
         <el-descriptions-item label="负责人邮箱">{{ merchantinfo.servicePhone }}</el-descriptions-item>
         <el-descriptions-item label="商户别名">{{ merchantinfo.alias }} <button class="el-icon-edit" @click="popupCustProp('商户别名')" style="margin-left: 5px"></button></el-descriptions-item>
         <el-descriptions-item label="经营模式" v-if="merchantinfo.isOnline">{{ merchantinfo.isOnline === 1 ? "线上经营" : "线下经营"  }} </el-descriptions-item>
       </el-descriptions>
    </el-card>
    <el-card style="margin-bottom:20px;">
      <div slot="header" class="clearfix">
          <span>结算信息</span>
       </div>
       <el-descriptions   :column="4" >
         <el-descriptions-item label="账户类型">{{ merchantinfo.accountTypeName }}</el-descriptions-item>
         <el-descriptions-item label="开户名">{{ merchantinfo.accountCardName }}</el-descriptions-item>
         <el-descriptions-item label="银行预留手机号">{{ merchantinfo.accountPhone }}</el-descriptions-item>
         <el-descriptions-item label="开户证件号">{{ merchantinfo.principalCertNo ?  merchantinfo.principalCertNo : merchantinfo.legalCertNo }}</el-descriptions-item>
         <el-descriptions-item label="开户账号">{{ merchantinfo.accountCardNum }}</el-descriptions-item>
         <el-descriptions-item label="开户支行">{{ merchantinfo.accountBankName }}</el-descriptions-item>
        </el-descriptions>
    </el-card>
        <!-- 通道信息 -->
    <el-card style="margin-bottom:20px;">
      <div slot="header" class="clearfix">
          <span>支付通道</span>
          <div> 
            <el-button
          v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"
          type="primary"
          @click="addchannelBtn()"
          ><i class="el-icon-plus"></i>添加通道
        </el-button>
        <el-button
          v-if="oemFlag == 1 && oeminfo.channelConfigSwitch == 1"
          type="primary"
          @click="addchannelBtn()"
          ><i class="el-icon-plus"></i>添加
        </el-button>  
        <el-button v-if="StarPostPaymentShow" @click="relatedStarPostPayment" type="primary" >关联星驿付</el-button>
          </div>
      </div>
      <el-table
          :data="channelinfo"
          tooltip-effect="dark"
          style="width: 100%"
          stripe
          :header-cell-style="channeHeaderColor"
        >
        <el-table-column prop="icon" label="通道标识"  align="center" >
          <template slot-scope="scope">
            <el-image 
                style="width: 70px; height: 50px"
                :src="scope.row.icon.split(',')[0]" 
                :preview-src-list="scope.row.icon.split(',')">
              </el-image>
        </template>
      </el-table-column>
        <el-table-column prop="channelName" label="通道名称"  align="center" />
        <el-table-column prop="mchId" label="渠道商户号"  align="center" />
        <el-table-column  :render-header="renderheader" label="支付宝商户号?微信商户号"  align="center" >
        <template slot-scope="scope">
            <p > {{ scope.row.aliSmid ? scope.row.aliSmid :'--'}} </p>
            <p > {{ scope.row.wxMchId ? scope.row.wxMchId : '--'}} </p>
        </template>
      </el-table-column>
      <el-table-column prop="reviewedStatusName" label="审核状态"  align="center" >
        <template slot-scope="scope">
          <div style="display: flex;align-items: center;justify-content: center;"> 
            <p > {{ scope.row.reviewedStatusName }} </p>
            <el-popover
              v-if="scope.row.reviewedStatus == 2"
                placement="top-start"
                title="驳回原因"
                width="200"
                trigger="hover"
                :content="scope.row.reviewedReason">
                <i slot="reference" style="margin:-5px 0 0 5px ;" class="el-icon-question" ></i>
              </el-popover>
          </div>  
        </template>
      </el-table-column>
        <el-table-column prop="channelName"   align="center" label="操作">
        <template slot-scope="scope">
          <!-- <el-button type="text" @click="balancePay(scope.row)" v-if="(userinfo.rolesId == 1 || userinfo.rolesId == 8) && scope.row.channelType == 16">余额支付</el-button> -->
          <!-- <el-button type="text" @click="openAccounts(scope.row)" v-if="(userinfo.rolesId == 1 || userinfo.rolesId == 8) && scope.row.channelType == 16">余额分账</el-button> -->
          <!-- <el-button type="text" @click="wxConfiguration(scope.row)" v-if="(userinfo.rolesId == 1 || userinfo.rolesId == 8) && scope.row.channelType == 16 && !scope.row.wxMchId">微信配置</el-button> -->
          

          <el-popconfirm
             title="是否确认提交？"
             v-if=" ( userinfo.rolesId == 1 || userinfo.rolesId == 8 ) && scope.row.reviewedStatus == 4 && (scope.row.channelId == 37 || scope.row.channelId == 71 || scope.row.channelType == 16)"
             @confirm="aisleSumbit(scope.row)"
           >
           <el-button slot="reference" type="text" style="margin-right:10px;">提交</el-button>
           </el-popconfirm>
          <el-button type="text" @click="businessConfig(scope.row)" v-if="(userinfo.rolesId == 1 || userinfo.rolesId == 8) && scope.row.channelType == 16 ">业务开通</el-button>
          <el-button type="text" @click="jumpChannel(scope.row.id)">定制</el-button>
          <el-button type="text" v-if=" scope.row.channelType == 4 && scope.row.reviewedStatus == 1 && scope.row.agreementStatus != 1 " @click="elecContractSign(scope.row.id)">签署电子协议</el-button>
          <el-button type="text" v-if=" scope.row.channelType == 6 && (scope.row.wxReviewedStatus == 4 || scope.row.wxReviewedStatus == null || scope.row.wxReviewedStatus) && scope.row.wxReviewedStatus != 2" @click="wxaddmch(merchantinfo.id , scope.row.id)">申请微信小微进件</el-button>
          <el-button type="text" v-if="scope.row.reviewedStatus == 2 || scope.row.reviewedStatus == 3" @click="revamp(scope.row.id)">{{scope.row.reviewedStatus == 2 ? '编辑' : '通过' }}</el-button>
          <!-- <el-button type="text" v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8" @click="deletechannel(scope.row.id)">停用</el-button> -->
          <el-link v-if="scope.row.channelType == 6 && scope.row.wxReviewedStatus == 1" :href="item.wxSignurl" type="primary">点击签约</el-link>
          <!-- <el-button @click="reject(scope.row.wxReviewedReason)"  type="text" v-if="scope.row.wxReviewedStatus == 4">驳回</el-button> -->
          <el-button  @click="Order(scope.row.channelOrderId)"  type="text" v-if=" scope.row.channelType == 4 && scope.row.reviewedStatus == 0 && scope.row.channelOrderId">工单号</el-button>
        </template>
      </el-table-column>
      </el-table>
    </el-card>

    <!-- 支付 -->
    <el-card style="margin-bottom:20px;">
      <div slot="header" class="clearfix" v-if="merchantinfo.status == 0 || merchantinfo.status == 98 || merchantinfo.status == 10 ">
          <span>支付方式</span>
          <el-button v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8" @click="jurisdictionbtn" type="primary" >权限配置</el-button>
      </div>
      <div
      class="container"
      v-if="
        merchantinfo.status == 0 ||
        merchantinfo.status == 98 ||
        merchantinfo.status == 10 "
    >
      <div class="payBox">
        <div class="thead">
          <span>支付方式</span>
          <span>支付通道</span>
          <span>支付配置</span>
          <span>费率配置</span>
          <span>结算周期</span>
          <!-- <span v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"
            >营销活动</span
          > -->
          <span>其他配置</span>
          <span>测试</span>
        </div>
        <div class="tbody">
          <div>微信</div>
          <div>
            {{ merchantinfo.wxChannelName }}
            <i class="el-icon-sort" @click="changechannelBox('1')"></i>
          </div>
          <div>
            <span class="bule" @click="wecharpayset('1')">设置</span>
          </div>

          <div>
            <div class="wid50">
              {{ splice(merchantinfo.wxChannelRate) }}‰&nbsp;
            </div>
            <span class="bule" @click="rateBtn('wx')">设置</span>
          </div>
          <div>
            {{ merchantinfo.wxSettlement }}
            <i
              class="el-icon-sort"
              v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"
              @click="SettlementBtn('1')"
            ></i>
          </div>
          <!-- <div v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8">
            绿洲
            <el-switch
              v-model="wecharlvzhou"
              @change="lvzhou(merchantinfo.wxChannelId)"
            >
            </el-switch>
          </div> -->
          <div>
            <div class="bule" style="width: 100%" @click="applistBtn">
              <span>微信关注配置</span>
            </div>
            <div class="bule" style="width: 100%" @click="wxminiprogrambtn">
              <span>微信小程序配置</span>
            </div>
          </div>
          <div>
            <span
              class="bule"
              @click="qrCodeTestBtn('400', merchantinfo.merchantNo)"
              >二维码测试</span
            >
          </div>
        </div>
        <div class="tbody">
          <div>支付宝</div>
          <div>
            {{ merchantinfo.aliChannelName }}
            <i class="el-icon-sort" @click="changechannelBox('2')"></i>
          </div>
          <div>
            <span class="bule" @click="wecharpayset('2')">设置</span>
          </div>

          <div>
            <div class="wid50">
              {{ splice(merchantinfo.aliChannelRate) }}‰&nbsp;
            </div>
            <span class="bule" @click="rateBtn('ali')">设置</span>
          </div>
          <div>
            {{ merchantinfo.aliSettlement }}
            <i
              class="el-icon-sort"
              v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"
              @click="SettlementBtn('2')"
            ></i>
          </div>
          <!-- <div v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8">
          
            <el-button
              v-if="alilanhaival == 0"
              type="primary"
              round
              @click="newlanhaibtn"
              >新蓝海(未开通)
            </el-button>
            <el-button v-else-if="alilanhaival == 1" type="warning" round
              >新蓝海(审核中)</el-button
            >
            <el-button v-else-if="alilanhaival == 2" type="success" round
              >新蓝海(已开通)</el-button
            >
            <el-button
              v-else-if="alilanhaival == 4"
              type="danger"
              round
              @click="newlanhaibtn()"
              >新蓝海(已驳回)
            </el-button>
          </div> -->
          <div>
            <div class="bule" style="width: 100%" @click="aliBoxs">
              支付宝授权配置
            </div>

            <div
              class="operbtn"
              style="width: 100%; color: #000fd8"
              @click="threebinding = true"
            >
              代运营配置
            </div>
          </div>
          <div>
            <span
              class="bule"
              @click="qrCodeTestBtn('300', merchantinfo.merchantNo)"
              >二维码测试</span
            >
          </div>
        </div>
        <div class="tbody" v-if="merchantinfo.uniChannelId">
          <div>云闪付</div>
          <div>
            {{ merchantinfo.uniChannelName }}
            <i class="el-icon-sort" @click="changechannelBox('3')"></i>
          </div>

          <div>
            <span class="bule"></span>
          </div>
          <div>
            <div class="wid50" v-if="merchantinfo.uniChannelRate">
              {{ splice(merchantinfo.uniChannelRate) }}‰&nbsp;
            </div>
            <span class="bule" @click="rateBtn('uni')">设置</span>
          </div>
          <div>
            <span class="bule"></span>
          </div>
          <!-- <div>
      
          </div> -->
          <div v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"></div>
          <div class="bule"></div>
        </div>
        <div class="tbody">
          <div>银行卡</div>
          <div></div>

          <div>
            <span class="bule" @click="banks = true">设置</span>
          </div>
          <div>
            <div class="wid50">
              信用卡/{{ (merchantinfo.creditcardProfitRate / 10).toFixed(2) }}‰
              <br />
              储蓄卡/{{
                (merchantinfo.debitcardProfitRate / 10).toFixed(2)
              }}‰封顶:{{ (merchantinfo.debitcardTopFee / 100).toFixed(2) }}元
            </div>
            <span class="bule" @click="cost = true">设置</span>
          </div>
          <div></div>
          <!-- <div>
          </div> -->
          <div v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"></div>
          <div class="bule"></div>
        </div>
        <div class="tbody" v-if="merchantinfo.bestpayChannelId">
          <div>翼支付</div>
          <div>
            {{ merchantinfo.bestpayChannelName }}
            <i class="el-icon-sort" @click="changechannelBox('4')"></i>
          </div>
          <div>
            <span class="bule"></span>
          </div>
          <div>
            <div class="wid50" v-if="merchantinfo.bestpayChannelRate">
              {{ splice(merchantinfo.bestpayChannelRate) }}‰&nbsp;
            </div>
            <span class="bule" @click="rateBtn('bestpay')">设置</span>
          </div>
          <div>
            <!-- 结算周期预留位子 -->
          </div>
          <!-- <div v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"></div> -->
          <div class="bule"></div>
        </div>
        <div class="tbody" v-if="merchantinfo.ecnyChannelId">
          <div>数字人民币</div>
          <div>
            {{ merchantinfo.ecnyChannelName }}
            <i class="el-icon-sort" @click="changechannelBox('5')"></i>
          </div>
          <div>
            <span class="bule"></span>
          </div>
          <div>
            <div class="wid50" v-if="merchantinfo.ecnyChannelRate">
              {{ splice(merchantinfo.ecnyChannelRate) }}‰&nbsp;
            </div>
            <span class="bule" @click="rateBtn('ecny')">设置</span>
          </div>
          <div>
            <!-- 结算周期预留位子 -->
          </div>
          <div v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"></div>
          <div class="bule"></div>
        </div>
        <div class="tbody" v-if="merchantinfo.longpayChannelId">
          <div>龙支付</div>
          <div>
            {{ merchantinfo.longpayChannelName }}
            <i class="el-icon-sort" @click="changechannelBox('6')"></i>
          </div>
          <div>
            <span class="bule"></span>
          </div>
          <div>
            <div class="wid50" v-if="merchantinfo.longpayChannelRate">
              {{ splice(merchantinfo.longpayChannelRate) }}‰&nbsp;
            </div>
            <span class="bule" @click="rateBtn('longpay')">设置</span>
          </div>
          <div>
            <!-- 结算周期预留位子 -->
          </div>
          <div v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"></div>
          <div class="bule"></div>
        </div>
      </div>
    </div>
    </el-card>
        <!-- 通道信息 -->
        <el-card style="margin-bottom:20px;">
      <div slot="header" class="clearfix">
          <span>分账配置</span>
          <div>
            <!-- && !merchantinfo.splitChannelId -->
            <el-button
          v-if="(userinfo.rolesId == 1 || userinfo.rolesId == 8) "
          type="primary"
          @click="switchChannelBtn()"
          ><i class="el-icon-plus"></i>{{ merchantinfo.splitChannelId ? '切换分账' :'开通分账'}}
        </el-button>
       </div>
      </div>
      <el-table
          :data=" merchantinfo.splitChannelId?[{}]:[]"
          tooltip-effect="dark"
          style="width: 100%"
          stripe
          :header-cell-style="channeHeaderColor"
        >
        <el-table-column prop="channelName" label="商户号"  align="center" >
           <template>
            {{ merchantinfo.merchantNo}}
           </template>
        </el-table-column>
        <el-table-column prop="channelName" label="通道名称"  align="center" >
          <template>
            {{ merchantinfo.splitChannelName}}
           </template>
        </el-table-column>
        <el-table-column prop="cardnum" label="账户名称"  align="center" >
          <template>
            {{ merchantinfo.walletName}}
           </template>
        </el-table-column>
        <el-table-column prop="wallet_no"  label="账户号"  align="center" >
          <template>
            {{ merchantinfo.walletNo}}
           </template>
        </el-table-column>
        <el-table-column prop="channelName" label="状态"  align="center" >
           <template slot-scope="scope">
            <p > {{ funChanne(merchantinfo.splitChannelType)}} </p>
            <!-- <p v-if="scope.row.isDiv == 0"> 待开通 </p>
            <p v-else-if="scope.row.isDiv == 1 && merchantinfo.splitPid == -1"> 已开通分账(分出方) </p>
            <p v-else-if="scope.row.isDiv == 1 && merchantinfo.splitPid != -1"> 已开通分账(接收方) </p>
            <p v-else> 审核中 </p> -->
           </template>
        </el-table-column>
      </el-table>
    </el-card>
    <!-- 支付 -->
    <!-- <div
      class="title"
      v-if="
        merchantinfo.status == 0 ||
        merchantinfo.status == 98 ||
        merchantinfo.status == 10
      "
    >
      <span>支付</span>
      <div>
        <el-button
          v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"
          type="primary"
          @click="jurisdictionbtn"
          >权限配置
        </el-button>
      </div>
    </div> -->
   
    <!-- 通道 -->
    <!-- <el-card style="margin-bottom:20px;">
      <div slot="header" class="clearfix" v-if="merchantinfo.status == 0 || merchantinfo.status == 98 || merchantinfo.status == 10 ">
          <span>支付通道</span>
          <div>
        <el-button
          v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"
          type="primary"
          @click="addchannelBtn()"
          ><i class="el-icon-plus"></i>添加
        </el-button>
        <el-button
          v-if="oemFlag == 1 && oeminfo.channelConfigSwitch == 1"
          type="primary"
          @click="addchannelBtn()"
          ><i class="el-icon-plus"></i>添加
        </el-button>
        <el-button
          v-if="addCPlatformBtnShow"
          type="primary"
          @click="addCPlatformBtn()"
          ><i class="el-icon-plus"></i>创建商户平台账号
        </el-button>
      </div>
      </div>
      <div
      class="container channel PaymentChannel"
      v-if="
        merchantinfo.status == 0 ||
        merchantinfo.status == 98 ||
        merchantinfo.status == 10
      "
    >
      <div class="cBox" v-for="(item, index) in channelinfo" :key="index">
        <div :title="item.reviewedReason" class="channelitem">
          <div class="state" v-if="item.reviewedStatus == 1">
            <span>通过</span>
          </div>
          <div class="review" v-if="item.reviewedStatus == 0">
            <span>审核中</span>
          </div>
          <div
            class="rejected head"
            v-if="item.reviewedStatus == 2"
            @click="revamp(item.id)"
          >
            <span>驳回</span>
          </div>
          <div
            class="passjia"
            v-if="item.reviewedStatus == 3"
            @click="revamp(item.id)"
          >
            <span>通过</span>
          </div>
          <div class="line">{{ item.channelName }}</div>
          <div class="line">
            <img :src="item.icon" alt />
          </div>
          <div
            class="delBtn"
            v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"
          >
            <i class="el-icon-error error" @click="deletechannel(item.id)"></i>
          </div>
          <div class="lines">
            <span
              v-if="
                item.channelType == 6 &&
                (item.wxReviewedStatus == 4 ||
                  item.wxReviewedStatus == null ||
                  item.wxReviewedStatus) &&
                item.wxReviewedStatus != 2
              "
              class="blueBtn fontsize12"
              @click="wxaddmch(merchantinfo.id, item.id)"
              >申请微信小微进件</span
            >
            <span
              v-if="
                item.channelType == 4 &&
                item.reviewedStatus == 1 &&
                item.agreementStatus != 1
              "
              class="blueBtn fontsize12"
              @click="elecContractSign(item.id)"
              >签署电子协议</span
            >
            <span v-if="item.channelType == 6 && item.wxReviewedStatus == 0"
              >小微审核中...</span
            >
            <span
              class="bule"
              @click="Order(item.channelOrderId)"
              v-if="
                item.channelType == 4 &&
                item.reviewedStatus == 0 &&
                item.channelOrderId
              "
              >工单号</span
            >
            <span
              class="blue"
              v-if="item.channelType == 6 && item.wxReviewedStatus == 2"
              >小微申请通过</span
            >
            <a
              class="bule"
              :href="item.wxSignurl"
              target="_blank"
              
              >点击签约</a
            >
            <div class="btn">
              <div
                
                v-if="
                  item.channelType == 16 ||
                    item.channelType == 24 ||
                    item.channelType == 26
                "
              >
                {{ item.isDiv == 0 ?' 开通分账 ' : item.isDiv == 1 ? (merchantinfo.splitPid == -1 ?'':'已开通分账(接收方)') : '审核中'}}
              </div>
          
            </div>
          </div>
          <div
            :title="item.wxReviewedReason"
            style="height: 20px; width: 100%; text-align: center; color: red"
          >
            <span
              @click="reject(item.wxReviewedReason)"
              v-if="item.wxReviewedStatus == 4"
              >驳回</span
            >
          </div>
          <div
            class="custom"
            v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"
          >
            <span >定制</span>
          </div>
        </div>

        <div class="tip"></div>
      </div>
    </div>
    </el-card> -->

    <!-- 优惠券 -->
    <el-card style="margin-bottom:20px;">
      <div slot="header" class="clearfix" >
          <span>优惠券通道</span>
          <el-button
          v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"
          type="primary"
          @click="showCodeChannel">
          <i class="el-icon-plus"></i>添加</el-button>
      </div>
      <div class="container channel">
      <div
        class="cBox discountCouponBox"
        v-for="(item, index) in codeList"
        :key="index"
      >
        <div
          :title="item.reviewedReason"
          class="channelitem"
          style="height: 200px"
        >
          <div class="line">{{ item.channelName }}</div>
          <div class="line">
            <i
              class="el-icon-s-shop"
              style="font-size: 50px"
              v-if="item.img === ''"
            ></i>
            <img :src="item.img" alt="" v-else style="margin-right: 0px" />
          </div>

          <div
            class="custom"
            v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"
            @click="codeDetail(item.channelId, item.merchantId)"
          >
            <span>定制</span>
          </div>
        </div>
      </div>

    </el-card>
    
    <!-- 优惠券 -->
    <!-- <div class="title">
      <span>优惠券通道</span>
      <div>
        <el-button
          v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"
          type="primary"
          @click="showCodeChannel"
          ><i class="el-icon-plus"></i>添加</el-button
        >
      </div>
    </div> -->
   
    <!-- 项目 -->
    <el-card style="margin-bottom:20px;">
      <div slot="header" class="clearfix" v-if="merchantinfo.status == 0 || merchantinfo.status == 98 || merchantinfo.status == 10 ">
          <span>项目</span>
      </div>
        <div
      class="container"
      v-if="
        merchantinfo.status == 0 ||
        merchantinfo.status == 98 ||
        merchantinfo.status == 10 "
    >
      <!-- 企迈智慧零售 -->
      <div v-if="merchantinfo.qimaiStatus == 1" class="project">
        <div class="projectitem">
          <el-button icon="el-icon-star-on" type="success" size="medium"
            >智慧零售</el-button>
        </div>
        <div class="tip">
          <span class="open">已开通</span>
        </div>
      </div>
      <div v-else class="project">
        <div class="projectitem">
          <el-button
            icon="el-icon-star-on"
            type="info"
            size="medium"
            @click="registerQiMai()"
            >智慧零售
          </el-button>
        </div>
        <div class="tip">
          <span class="bule" @click="registerQiMai()">开通</span>
        </div>
      </div>
      <!-- 总分店模式 -->
      <div class="project" v-if="merchantinfo.pid">
        <div class="projectitem">
          <el-button icon="el-icon-star-on" type="primary" size="medium"
            >总分店</el-button
          >
        </div>
        <div class="tip">
          <span class="bule" @click="zonefendianbtn(merchantinfo.id)">编辑</span
          >&nbsp;&nbsp;
          <span class="red" @click="chainclose(merchantinfo.id)">关闭</span>
        </div>
      </div>
      <!-- 流量包 -->
      <div
        class="project"
        v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"
      >
        <div v-if="merchantinfo.pointId == null">
          <div class="projectitem">
            <el-button
              icon="el-icon-star-on"
              type="info"
              size="medium"
              @click="popupMerPoint()"
              >流量包
            </el-button>
          </div>
          <div class="tip">
            <span class="bule" @click="popupMerPoint()">开通</span>
          </div>
        </div>
        <div v-else>
          <div class="projectitem">
            <el-button
              icon="el-icon-star-on"
              type="success"
              size="medium"
              @click="jumpMerPoint(merchantinfo.pointId)"
              >流量包</el-button
            >
          </div>
          <div class="tip">
            <span class="open">已开通</span>
          </div>
        </div>
      </div>
      <!-- 额度包 -->

      <div
        class="project"
        v-if="
          merchantinfo.aliChannelType == 44 ||
          merchantinfo.wxChannelType == 44 ||
          merchantinfo.bestpayChannelType == 44
        "
      >
        <div>
          <div class="projectitem">
            <el-button
              icon="el-icon-star-on"
              type="success"
              size="medium"
              @click="popupQuotaPoint()"
              >额度包
            </el-button>
          </div>
          <div class="tip">
            <span class="bule" @click="popupQuotaPoint()">配置</span>
          </div>
        </div>
      </div>

      <el-dialog title="额度包配置" :visible.sync="quotaPoint" width="35%">
        <el-form class="demo-dynamic">
          <el-form-item :required="true" label="额度包（元）">
            <el-input
              type="text"
              v-model.trim="quota"
              autocomplete="off"
            ></el-input>
          </el-form-item>
          <el-form-item label="已使用额度">
            <el-input
              type="text"
              v-model.trim="residualQuota"
              :disabled="true"
              autocomplete="off"
            ></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="quotaPoint = false">取 消</el-button>
          <el-button type="primary" @click="configureQuota()">确 定</el-button>
        </div>
      </el-dialog>

      <!-- 单品优惠券 -->
      <div class="project" hidden>
        <div class="projectitem">
          <el-button
            icon="el-icon-star-on"
            type="info"
            size="medium"
            @click="openCoupon()"
            >单品优惠券
          </el-button>
        </div>
        <div class="tip">
          <span class="bule" @click="openCoupon()">开通</span>
        </div>
      </div>
      <div hidden>
        <div class="projectitem">
          <el-button
            icon="el-icon-star-on"
            type="success"
            size="medium"
            @click="openCoupon()"
            >流量包</el-button
          >
        </div>
        <div class="tip">
          <span class="open">已开通</span>
        </div>
      </div>
    </div>
    </el-card>

    <!-- <div
      class="title"
      v-if="
        merchantinfo.status == 0 ||
        merchantinfo.status == 98 ||
        merchantinfo.status == 10
      "
    >
      <span>项目</span>
    </div> -->
   
    <!-- 标签 -->
    <el-card style="margin-bottom:20px;">
      <div slot="header" class="clearfix" v-if="this.rolesId == 1 || this.rolesId == 2 || this.rolesId == 8 || this.rolesId == 9">
          <span>项目</span>
          <div>
           <el-button type="primary" @click="popuptag">添加标签</el-button>
         </div>
      </div>
        <div
      class="container container1"
      v-if="
        this.rolesId == 1 ||
        this.rolesId == 2 ||
        this.rolesId == 8 ||
        this.rolesId == 9
      "
    >
      <el-tag
        class="el_tag"
        v-for="item in adm_tag"
        closable
        @close="handleClose(item.key)"
        :key="item.label"
        effect="plain"
      >
        {{ item.label }}
      </el-tag>
      <el-tag
        class="el_tag"
        v-for="item in cw_tag"
        closable
        @close="handleClose(item.key)"
        type="success"
        :key="item.label"
        effect="plain"
      >
        {{ item.label }}
      </el-tag>
      <el-tag
        class="el_tag"
        v-for="item in fws_tag"
        closable
        @close="handleClose(item.key)"
        type="warning"
        :key="item.label"
        effect="plain"
      >
        {{ item.label }}
      </el-tag>
    </div>
    </el-card>

    <!-- <div
      class="title"
      v-if="
        this.rolesId == 1 ||
        this.rolesId == 2 ||
        this.rolesId == 8 ||
        this.rolesId == 9
      "
    >
      <span>标签</span>
      <div>
        <el-button type="primary" @click="popuptag">添加标签</el-button>
      </div>
    </div> -->
   
    <br />
    <br />
    <!-- 测试二维码 -->
    <el-dialog
      title="测试二维码"
      :visible.sync="showQRCode"
      width="500px"
      :before-close="closeQrCode"
    >
      <div class="code-title">
        <p>{{ payTypeTitle == "400" ? "公众号" : "生活号" }}</p>
        <p>{{ payTypeTitle == "400" ? "小程序" : "二维码" }}</p>
      </div>
      <div class="codes">
        <div id="vueQr" ref="qrCodeUrl"></div>
        <div id="vueQr" class="DpayCode" ref="DpayCodeUrl"></div>
      </div>

      <span slot="footer" class="dialog-footer">
        <el-button @click="showQRCode = false">取 消</el-button>
        <el-button type="primary" @click="showQRCode = false">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 创建商户平台账号 -->
    <el-dialog
      v-dialogDrag
      title="创建商户平台账号"
      :visible.sync="CPlatformvisible"
      width="45%"
      :close-on-click-modal="false"
    >
      <div class="Box">
        <el-form
          label-position="left"
          :model="ruleForm"
          status-icon
          :rules="channer"
          label-width="160px"
          class="demo-ruleForm"
        >
          <el-form-item label="可选择通道" prop="channerlist">
            <el-checkbox-group v-model="checkboxGroup5">
              <el-checkbox
                v-for="(item, index) in channerlists"
                :key="index"
                :label="item.id"
                :value="item.id"
                border
                >{{ item.channelname }}</el-checkbox
              >
            </el-checkbox-group>
          </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="CPlatformvisible = false">取消</el-button>
        <el-button type="primary" @click="addCPlatform">确定</el-button>
      </span>
    </el-dialog>
    <!-- 微信支付配置 -->
    <el-dialog
      v-dialogDrag
      title="支付配置"
      :visible.sync="visible"
      width="45%"
      :close-on-click-modal="false"
    >
      <el-form
        :model="paydeploy"
        status-icon
        ref="paydeploy"
        label-width="140px"
        class="demo-dynamic"
      >
        <el-form-item label="渠道商户号">
          <el-input
            type="text"
            v-model="paydeploy.mchId"
            :disabled="mchiddis"
            autocomplete="off"
          >
            <el-button
              slot="append"
              type="info"
              size="medium"
              @click="mchiddisBtn()"
              >修改</el-button
            >
          </el-input>
        </el-form-item>
        <el-form-item v-if="paydeploy.channelType == 25" label="商户号">
          <el-input
            type="text"
            v-model="paydeploy.servAppid"
            autocomplete="off"
          >
          </el-input>
        </el-form-item>
        <!-- <el-form-item v-if="paydeploy.channelType == 25" label="key">
                  <el-input type="text" v-model="paydeploy.mchKey"  autocomplete="off">
                  </el-input>
                </el-form-item> -->
        <!-- <el-form-item  label="服务商机构号">
          <el-input
            type="text"
            v-model="paydeploy.servInstno"
            autocomplete="off"
          >
          </el-input>
        </el-form-item> -->

        <el-form-item v-if="paydeploys == 1" label="渠道微信子商户">
          <el-input
            type="text"
            v-model="paydeploy.wxMchId"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item v-if="paydeploys == 1" label="服务商模式">
          <el-select
            class="servicelevel"
            v-model="paydeploy.wxMode"
            placeholder
          >
            <el-option keys="1" label="服务商模式" :value="0"></el-option>
            <el-option keys="2" label="子商户模式" :value="1"></el-option>
            <el-option keys="3" label="H5跳转模式" :value="2"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="小程序appid">
          <el-input
            type="text"
            v-model="paydeploy.miniAppid"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          v-show="paydeploy.wxMode == 1 && paydeploys == 1"
          label="appid"
        >
          <el-input
            type="text"
            v-model="paydeploy.wxAppid"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          v-show="paydeploy.wxMode == 1 && paydeploys == 1"
          label="appsecret"
        >
          <el-input
            type="text"
            v-model="paydeploy.wxAppsecret"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          v-show="
            paydeploy.channelType == 3 ||
            paydeploy.channelType == 9 ||
            paydeploy.channelType == 15 ||
            paydeploy.channelType == 12 ||
            paydeploy.channelType == 25
          "
          label="商户秘钥"
        >
          <el-input
            type="text"
            v-model="paydeploy.mchKey"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          v-show="
            paydeploy.channelType == 3 ||
            paydeploy.channelType == 9 ||
            paydeploy.channelType == 15 ||
            paydeploy.channelType == 12
          "
          label="app-appid"
        >
          <el-input
            type="text"
            v-model="paydeploy.appAppid"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item v-show="paydeploy.channelType == 8" label="门店id">
          <el-input
            type="text"
            v-model="paydeploy.mchKey"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item v-show="paydeploy.channelType == 42" label="key">
          <el-input
            type="text"
            v-model="paydeploy.servKey"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <!-- 支付宝官方直连 !-->
        <el-form-item
          v-show="merchantinfo.aliChannelType == 6 && paydeploys == 2"
          label="支付宝appid"
        >
          <el-input
            type="text"
            v-model="paydeploy.aliAppid"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          v-show="merchantinfo.aliChannelType == 6 && paydeploys == 2"
          label="口碑授权token"
        >
          <el-input
            type="text"
            v-model="paydeploy.aliToken"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          v-show="merchantinfo.aliChannelType == 6 && paydeploys == 2"
          label="pid"
        >
          <el-input
            type="text"
            v-model="paydeploy.aliPid"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          v-show="merchantinfo.aliChannelType == 6 && paydeploys == 2"
          label="外部门店编号"
        >
          <el-input
            type="text"
            v-model="paydeploy.aliOuterid"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item
          v-show="merchantinfo.aliChannelType == 6 && paydeploys == 2"
          label="支付宝商户ID"
        >
          <el-input
            type="text"
            v-model="paydeploy.aliUserId"
            :disabled="
              userinfo.rolesId == 1 || userinfo.rolesId == 8 ? false : true
            "
            autocomplete="off"
          ></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button v-if="paydeploys == 1" type="primary" @click="updatewx()"
          >确定</el-button
        >
        <el-button v-if="paydeploys == 2" type="primary" @click="updateali()"
          >确定</el-button
        >
      </span>
    </el-dialog>

    <!-- 微信关注配置 -->
    <el-dialog
      v-dialogDrag
      title="微信关注配置"
      :visible.sync="attention"
      width="60%"
      :close-on-click-modal="false"
    >
      <el-form
        :model="paydeploy"
        status-icon
        ref="paydeploy"
        label-width="110px"
        class="demo-dynamic"
      >
        <div
          style="
            width: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
          "
        >
          <el-input
            style="width: 38%; margin-right: 2%"
            type="text"
            placeholder="支付appid"
            v-model="addappid.payappid"
          ></el-input>
          <el-input
            style="width: 38%; margin-right: 2%"
            type="text"
            placeholder="关注appid"
            v-model="addappid.attentionid"
          ></el-input>
          <el-button type="primary" @click="addappids">添加</el-button>
        </div>
        <el-table
          :data="wxlists.appidList"
          style="width: 100%"
          max-height="250"
          align="center"
        >
          <el-table-column
            fixed
            prop="subappid"
            label="支付appid"
            align="center"
          ></el-table-column>
          <el-table-column fixed prop="status" label="状态" align="center">
            <template slot-scope="scope">
              <span v-if="scope.row.status == 0">正常</span>
              <span v-else-if="scope.row.status == 1">驳回</span>
              <span v-else-if="scope.row.status == 2">处理中</span>
            </template>
          </el-table-column>
          <el-table-column
            fixed
            prop="failReason"
            label="说明"
            align="center"
          ></el-table-column>
          <el-table-column
            fixed
            prop="subscribeappid"
            label="关注appid"
            align="center"
          ></el-table-column>
          <el-table-column fixed="right" label="操作" width="120">
            <template slot-scope="scope">
              <el-button
                v-if="scope.row.delete"
                @click.native.prevent="
                  deleteRow(
                    scope.$index,
                    wxlists.appidList,
                    wxlists.appidList.length
                  )
                "
                type="text"
                size="small"
                >删除
              </el-button>
              <el-button
                type="text"
                size="small"
                @click="appremove(scope.row.id)"
                v-if="scope.row.status == 1"
                >删除
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <div class="flex">
          <el-form-item label="支付授权目录" style="width: 100%">
            <el-select
              style="width: 100px; margin-right: 5%"
              class="servicelevel"
              v-model="paydeploy.urltype"
              placeholder
            >
              <el-option keys="1" label="http://" value="http://"></el-option>
              <el-option keys="2" label="https://" value="https://"></el-option>
            </el-select>
            <el-input
              style="width: 200px; margin-right: 5%"
              type="text"
              placeholder="支付授权目录"
              v-model="paydeploy.url"
            ></el-input>
            <el-button type="primary" @click="addurl">添加</el-button>
          </el-form-item>
        </div>
        <div style="padding: 10px 30px; box-sizing: border-box; color: red">
          所有使用JS API方式发起支付请求的链接地址，都必须在支付授权目录之下
          <br />最多设置5个支付授权目录, 且域名必须通过ICP备案
          <br />头部要包含http或https，以左斜杠“/”结尾
          <br />
        </div>
        <el-table
          :data="wxlists.jspathList"
          style="width: 100%"
          max-height="250"
          align="center"
        >
          <el-table-column
            fixed
            prop="jsapipath"
            label="支付授权目录"
            align="center"
          ></el-table-column>
          <el-table-column fixed prop="status" label="状态" align="center">
            <template slot-scope="scope">
              <span v-if="scope.row.status == 0">正常</span>
              <span v-else-if="scope.row.status == 1">驳回</span>
              <span v-else-if="scope.row.status == 2">处理中</span>
            </template>
          </el-table-column>
          <el-table-column
            fixed
            prop="failReason"
            label="说明"
            align="center"
          ></el-table-column>
          <el-table-column fixed="right" label="操作" width="120">
            <template slot-scope="scope">
              <el-button
                v-if="scope.row.delete"
                @click.native.prevent="
                  deleteRow(
                    scope.$index,
                    wxlists.jspathList,
                    wxlists.jspathList.length
                  )
                "
                type="text"
                size="small"
                >删除
              </el-button>
              <el-button
                type="text"
                size="small"
                @click="appremove(scope.row.id)"
                v-if="scope.row.status == 1"
                >删除
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="attention = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="appsave()">确定</el-button>
      </span>
    </el-dialog>
    <!-- 微信小程序配置 -->
    <el-dialog
      v-dialogDrag
      title="微信小程序关注配置"
      :visible.sync="wxminiprogram"
      width="60%"
      :close-on-click-modal="false"
    >
      <el-form
        :model="paydeploy"
        status-icon
        ref="paydeploy"
        label-width="110px"
        class="demo-dynamic"
      >
        <div
          style="
            width: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
          "
        >
          <el-input
            style="width: 38%; margin-right: 2%"
            type="text"
            placeholder="支付appid"
            v-model="addappid.payappid"
          ></el-input>
          <el-button type="primary" @click="addappids">添加</el-button>
        </div>
        <el-table
          :data="wxlists.appidList"
          style="width: 100%"
          max-height="250"
          align="center"
        >
          <el-table-column
            fixed
            prop="subappid"
            label="支付appid"
            align="center"
          ></el-table-column>
          <el-table-column fixed prop="status" label="状态" align="center">
            <template slot-scope="scope">
              <span v-if="scope.row.status == 0">正常</span>
              <span v-else-if="scope.row.status == 1">驳回</span>
              <span v-else-if="scope.row.status == 2">处理中</span>
            </template>
          </el-table-column>
          <el-table-column
            fixed
            prop="failReason"
            label="说明"
            align="center"
          ></el-table-column>
          <el-table-column fixed="right" label="操作" width="120">
            <template slot-scope="scope">
              <el-button
                v-if="scope.row.delete"
                @click.native.prevent="
                  deleteRow(
                    scope.$index,
                    wxlists.appidList,
                    wxlists.appidList.length
                  )
                "
                type="text"
                size="small"
                >删除
              </el-button>
              <el-button
                type="text"
                size="small"
                @click="appremove(scope.row.id)"
                v-if="scope.row.status == 1"
                >删除
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="wxminiprogram = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="appsave(2)">确定</el-button>
      </span>
    </el-dialog>
    <!-- 费率配置 -->
    <el-dialog
      v-dialogDrag
      title="费率配置"
      :visible.sync="rate"
      width="45%"
      :close-on-click-modal="false"
    >
      <el-form
        :model="ratearr"
        status-icon
        ref="ratearr"
        label-width="110px"
        class="demo-dynamic"
      >
        <el-form-item label="通道">
          <el-input
            type="text"
            autocomplete="off"
            :value="ChannelName"
            disabled
          ></el-input>
        </el-form-item>
        <el-form-item label="费率">
          <el-select
            class="servicelevels"
            v-model="ratearr.ratenum"
            placeholder="选择费率"
            @change="rateevent"
          >
            <el-option
              v-for="(item, index) in ratelists"
              :key="index"
              :label="item.rate / 10"
              :value="item.rate"
            ></el-option>
          </el-select>
          ‰
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="rate = false">取消</el-button>
        <el-button type="primary" @click="rateok">确定</el-button>
      </span>
    </el-dialog>
    <!-- 切换通道 -->
    <el-dialog
      v-dialogDrag
      title="切换通道"
      :visible.sync="changechannel"
      width="45%"
      :close-on-click-modal="false"
    >
      <el-form status-icon ref="channelarr" class="demo-dynamic">
        <el-form-item label="通道">
          <el-select
            class="servicelevel"
            v-model="change_channel_value"
            placeholder="选择通道"
            :disabled="rateswitch"
            @change="changechanne"
          >
            <el-option
              v-for="(item, index) in channellist"
              :key="index"
              :label="item.channelName"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="changechannel = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="channelok">确定</el-button>
      </span>
    </el-dialog>
    <!-- 结算周期 -->
    <el-dialog
      v-dialogDrag
      title="结算配置"
      :visible.sync="checkout"
      width="45%"
      :close-on-click-modal="false"
    >
      <el-form
        v-if="settlementtype == 1"
        status-icon
        ref="channelarr"
        class="demo-dynamic"
      >
        <el-form-item label="结算">
          <el-select
            class="servicelevel"
            v-model="channelarr.wxSettlement"
            placeholder="选择结算"
          >
            <el-option
              v-for="(item, index) in Settlement"
              :key="index"
              :label="item"
              :value="item"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <el-form
        v-if="settlementtype == 2"
        status-icon
        ref="channelarr"
        class="demo-dynamic"
      >
        <el-form-item label="结算">
          <el-select
            class="servicelevel"
            v-model="channelarr.aliSettlement"
            placeholder="选择结算"
          >
            <el-option
              v-for="(item, index) in Settlement"
              :key="index"
              :label="item"
              :value="item"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="checkout = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="updatesettlement">确定</el-button>
      </span>
    </el-dialog>
    <!-- 支付宝授权配置 -->
    <el-dialog
      v-dialogDrag
      title="口碑授权"
      :visible.sync="aliBox"
      width="45%"
      :close-on-click-modal="false"
    >
      <div class="alibox">
        <span class="itemtit">APPID</span>
        <span>{{ alipayautharr.appId }}</span>
      </div>
      <div class="alibox">
        <span class="itemtit">授权码</span>
        <div>
          <div id="qrcode"></div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="aliBox = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="aliBox = false">确定</el-button>
      </span>
    </el-dialog>
    <!-- 银行卡支付配置 -->
    <el-dialog
      v-dialogDrag
      title="银行卡支付配置"
      :visible.sync="banks"
      width="45%"
      :close-on-click-modal="false"
    >
      <el-form
        :model="bank"
        status-icon
        ref="bank"
        label-width="110px"
        class="demo-dynamic"
      >
        <el-form-item label="银联商户号">
          <el-input
            type="text"
            v-model="bank.mchId"
            autocomplete="off"
            placeholder="银联商户号"
          ></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="banks = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="addbank()">确定</el-button>
      </span>
    </el-dialog>
    <!-- 银行卡成本 -->
    <el-dialog
      v-dialogDrag
      title="修改成本"
      :visible.sync="cost"
      width="45%"
      :close-on-click-modal="false"
    >
      <el-form
        :model="bank"
        status-icon
        ref="bank"
        label-width="110px"
        class="demo-dynamic"
      >
        <el-form-item label="信用卡" style="width: 80%">
          <el-input
            style="width: 80%"
            type="text"
            v-model="costs.creditcardProfitRate"
            autocomplete="off"
            placeholder="信用卡"
          ></el-input>
          <span>‰</span>
        </el-form-item>
        <el-form-item label="储蓄卡" style="width: 80%">
          <el-input
            style="width: 80%"
            type="text"
            v-model="costs.debitcardProfitRate"
            autocomplete="off"
            placeholder="储蓄卡"
          ></el-input>
          <span>‰</span>
        </el-form-item>
        <el-form-item label="封顶" style="width: 80%">
          <el-input
            style="width: 80%"
            type="text"
            v-model="costs.debitcardTopFee"
            autocomplete="off"
            placeholder="储蓄卡"
          ></el-input>
          <span>元</span>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cost = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="updateBankRate()">确定</el-button>
      </span>
    </el-dialog>
    <!-- 添加通道 -->
    <el-dialog
      v-dialogDrag
      title="添加通道"
      :visible.sync="addchannel"
      width="45%"
      :close-on-click-modal="false"
    >
      <el-form status-icon ref="channelarr" class="demo-dynamic">
        <el-form-item label="通道">
          <el-select
            class="servicelevel"
            v-model="channelarr.channelid"
            @change="watchchannel"
            placeholder="选择通道"
          >
            <el-option
              v-for="(item, index) in channellists"
              :key="index"
              :label="item.options"
              :value="item.code"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="费率">
          <el-select
            class="servicelevels"
            v-model="channelrate"
            placeholder="选择费率"
            @change="channelrates"
          >
            <el-option
              v-for="(item, index) in ratelists"
              :key="index"
              :label="item.rate / 10"
              :value="item.rate"
            ></el-option>
          </el-select>
          ‰
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addchannel = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="addchannelok">确定</el-button>
      </span>
    </el-dialog>
    <!-- 添加开通分账 -->
    <el-dialog
      v-dialogDrag
      :title="merchantinfo.splitChannelId ? '切换分账' :'开通分账'"
      :visible.sync="switchchannel"
      width="45%"
      :close-on-click-modal="false"
    >
      <el-form status-icon ref="channelarr" class="demo-dynamic">
        <el-form-item label="通道">
          <el-select
            class="servicelevel"
            v-model="channelarr.channelid"
           
            placeholder="选择通道"
          >
            <el-option
              v-for="(item, index) in channellists"
              :key="index"
              :label="item.channelname"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="费率">
          <el-select
            class="servicelevels"
            v-model="channelrate"
            placeholder="选择费率"
            @change="channelrates"
          >
            <el-option
              v-for="(item, index) in ratelists"
              :key="index"
              :label="item.rate / 10"
              :value="item.rate"
            ></el-option>
          </el-select>
          ‰
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="switchchannel = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="switchChannelok">确定</el-button>
      </span>
    </el-dialog>
    <!-- 签约小微 -->
    <el-dialog
      v-dialogDrag
      title="签约小微"
      :visible.sync="signingBox"
      width="45%"
      :close-on-click-modal="false"
    >
      <div class="alibox">
        <span class="itemtit">签约码</span>
        <div>
          <div class="signingcode"></div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="signingBox = false">关闭</el-button>
        <!-- @click="visible = false" -->
      </span>
    </el-dialog>
    <!-- 标签配置 -->
    <el-dialog
      v-dialogDrag
      title="添加标签"
      :visible.sync="Channeldeploy1"
      width="35%"
      :close-on-click-modal="false"
    >
      <el-transfer
        v-model="usedTags"
        :data="unUsedTags"
        :titles="['未选标签', '已选择标签']"
        filterable
        filter-placeholder="请输入关键词"
      >
        <!--  -->
      </el-transfer>
      <div style="width: 100%; text-align: right; margin-top: 30px">
        <el-button type="primary" @click="Channeldeploy1 = false"
          >取消</el-button
        >
        <el-button type="primary" @click="addLabel()">确定</el-button>
      </div>
    </el-dialog>
    <!-- 开通电子发票 -->
    <el-dialog
      v-dialogDrag
      title="开通电子发票"
      :visible.sync="bill"
      width="45%"
      :close-on-click-modal="false"
    >
      <el-form
        :model="invoices"
        status-icon
        ref="invoices"
        label-width="110px"
        class="demo-dynamic"
      >
        <el-form-item label="税盘号">
          <el-input
            type="text"
            autocomplete="off"
            :value="invoices.num"
          ></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="bill = false">取消</el-button>
        <el-button type="primary">确定</el-button>
      </span>
    </el-dialog>
    <!-- 总分店模式配置 -->
    <el-dialog
      v-dialogDrag
      title="总分店模式配置"
      :visible.sync="zongfendian"
      width="45%"
      :close-on-click-modal="false"
    >
      <el-form
        :model="setupshops"
        status-icon
        ref="setupshops"
        label-width="110px"
        class="demo-dynamic"
      >
        <el-form-item label="角色选择">
          <el-radio-group v-model="setupshops.type">
            <el-radio label="-1">总店</el-radio>
            <el-radio label="2">分店</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="选择总店" v-if="setupshops.type == 2">
          <!-- <el-input :disabled="(setupshops.type == 1)?true:false" type="text" v-model.trim="addmendian.phone" autocomplete="off"></el-input> -->
          <el-autocomplete
            v-if="
              userinfo.rolesId == 1 ||
              userinfo.rolesId == 8 ||
              userinfo.rolesId == 2 ||
              userinfo.rolesId == 9
            "
            class="servicename"
            v-model.trim="setupshops.dianming"
            :fetch-suggestions="querySearch3"
            placeholder="选择总店"
            @select="dianming"
          ></el-autocomplete>
        </el-form-item>
        <el-form-item label="选择营业时间" v-if="setupshops.type == 2">
          <el-time-picker
            v-model="setupshops.openTime"
            value-format="HH:mm"
            format="HH:mm"
            placeholder="开始时间"
          >
          </el-time-picker>
          至
          <el-time-picker
            v-model="setupshops.closeTime"
            value-format="HH:mm"
            format="HH:mm"
            placeholder="结束时间"
          >
          </el-time-picker>
        </el-form-item>
        <el-form-item label="是否限额" v-if="setupshops.type == 2">
          <el-radio-group
            v-model="setupshops.permissions"
            :disabled="setupshops.type == 1 ? true : false"
          >
            <el-radio label="1">是</el-radio>
            <el-radio label="2">否</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="限额额度" v-if="setupshops.type == 2">
          <el-input
            style="width: 80%"
            placeholder="请输入限额额度"
            :disabled="setupshops.permissions == 2 ? true : false"
            type="text"
            v-model.trim="setupshops.lines"
            autocomplete="off"
          ></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="zongfendian = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="setupshopok()">确定</el-button>
      </span>
    </el-dialog>
    <!-- 分账配置 -->
    <el-dialog
      v-dialogDrag
      title="分账配置"
      :visible.sync="fenzhang"
      width="45%"
      :close-on-click-modal="false"
    >
      <div class="demo-input-size">
        <el-autocomplete
          style="width: 40%; margin-right: 10px"
          class="servicename"
          v-model.trim="fenzhangs.name"
          :fetch-suggestions="querySearch"
          placeholder="商户号"
          @select="serviceid"
        ></el-autocomplete>
        <el-input
          style="width: 40%; margin-right: 10px"
          placeholder="分账比例"
          maxlength="3"
          v-model="fenzhangs.splitRate"
          oninput="if(this.value=='00'){this.value='0';}else{this.value=this.value.replace(/[^0-9]/g,'')}"
        >
        </el-input>
        <el-button type="primary" plain @click="addfenzhang()">添加</el-button>
      </div>
      <el-table
        :data="fenzhangData"
        style="width: 100%"
        v-loading="accountLoading"
      >
        <el-table-column
          align="center"
          prop="merchantNo"
          label="商户号"
        ></el-table-column>
        <el-table-column
          align="center"
          prop="merchantName"
          label="商户名"
        ></el-table-column>
        <el-table-column
          align="center"
          prop="splitRate"
          label="分账比例(%)"
        ></el-table-column>
        <el-table-column fixed="right" align="center" label="操作" width="120">
          <template slot-scope="scope">
            <el-button
              type="text"
              size="small"
              @click="delfenzhang(scope.row.merchantNo)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button @click="fenzhang = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="splitconfigt()">确定</el-button>
      </span>
    </el-dialog>
    <!-- 权限配置 -->
    <el-dialog
      v-dialogDrag
      title="权限配置"
      :visible.sync="jurisdiction"
      width="45%"
      :close-on-click-modal="false"
    >
      <el-form ref="form" size="mini" label-position="left" label-width="125px">
        <el-form-item label="门店管理员退款" prop="delivery">
          <el-switch
            active-value="1"
            inactive-value="0"
            v-model="merchantinfo.shopRefund"
          ></el-switch>
        </el-form-item>
        <!-- 支付宝 -->
        <el-form-item
          class="border pay-form-inline"
          label="支付宝支付总开关"
          prop="delivery"
        >
          <el-switch
            active-value="1"
            inactive-value="0"
            v-model="merchantinfo.aliSwitch"
          ></el-switch>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="B扫C">
          <el-radio-group
            v-model="payinfo.aliborc"
            :disabled="merchantinfo.aliSwitch == 1 ? false : true"
          >
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="C扫B">
          <el-radio-group
            v-model="payinfo.alicorb"
            :disabled="merchantinfo.aliSwitch == 1 ? false : true"
          >
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="退款">
          <el-radio-group
            v-model="payinfo.alirefund"
            :disabled="merchantinfo.aliSwitch == 1 ? false : true"
          >
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
            <el-radio label="2">不可隔日退款</el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- 微信 -->
        <el-form-item
          class="border pay-form-inline"
          label="微信支付总开关"
          prop="delivery"
        >
          <el-switch
            active-value="1"
            inactive-value="0"
            v-model="merchantinfo.wxSwitch"
          ></el-switch>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="B扫C">
          <el-radio-group
            v-model="payinfo.wxborc"
            :disabled="merchantinfo.wxSwitch == 1 ? false : true"
          >
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="C扫B">
          <el-radio-group
            v-model="payinfo.wxcorb"
            :disabled="merchantinfo.wxSwitch == 1 ? false : true"
          >
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="退款">
          <el-radio-group
            v-model="payinfo.wxrefund"
            :disabled="merchantinfo.wxSwitch == 1 ? false : true"
          >
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
            <el-radio label="2">不可隔日退款</el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- 云闪付 -->
        <el-form-item
          class="border pay-form-inline"
          label="云闪付支付总开关"
          prop="delivery"
        >
          <el-switch
            active-value="1"
            inactive-value="0"
            v-model="merchantinfo.uniSwitch"
          ></el-switch>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="B扫C">
          <el-radio-group
            v-model="payinfo.uniborc"
            :disabled="merchantinfo.uniSwitch == 1 ? false : true"
          >
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="C扫B">
          <el-radio-group
            v-model="payinfo.unicorb"
            :disabled="merchantinfo.uniSwitch == 1 ? false : true"
          >
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="退款">
          <el-radio-group
            v-model="payinfo.unirefund"
            :disabled="merchantinfo.uniSwitch == 1 ? false : true"
          >
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
            <el-radio label="2">不可隔日退款</el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- 银行卡 -->
        <el-form-item
          class="border pay-form-inline"
          label="银行卡支付总开关"
          prop="delivery"
        >
          <el-switch
            active-value="1"
            inactive-value="0"
            v-model="merchantinfo.bankSwitch"
          ></el-switch>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="刷卡">
          <el-radio-group
            v-model="payinfo.bankborc"
            :disabled="merchantinfo.bankSwitch == 1 ? false : true"
          >
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="退款">
          <el-radio-group
            v-model="payinfo.bankrefund"
            :disabled="merchantinfo.bankSwitch == 1 ? false : true"
          >
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
            <el-radio label="2">不可隔日退款</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="jurisdiction = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="payjurisdiction()">确定</el-button>
      </span>
    </el-dialog>
    <!-- 代运营配置 -->
    <el-dialog
      v-dialogDrag
      title="代运营配置"
      :visible.sync="threebinding"
      width="50%"
      :close-on-click-modal="false"
    >
      <el-tabs type="border-card">
        <el-tab-pane label="①代运营申请">
          <el-form
            status-icon
            ref="tarminal"
            label-width="150px"
            class="demo-dynamic"
          >
            <el-form-item label="支付宝登录账号">
              <el-input
                type="text"
                v-model.trim="alipayAccount"
                autocomplete="off"
              ></el-input>
            </el-form-item>
          </el-form>
          <div style="text-align: center">
            <el-button type="primary" @click="operationapply()">绑定</el-button>
          </div>
        </el-tab-pane>
        <el-tab-pane label="②同步运营操作结果">
          <div
            class="operbtn"
            style="width: 100%; color: #000fd8; margin: 5px 0"
            @click="operationresult()"
          >
            同步运营操作结果
          </div>
        </el-tab-pane>
        <el-tab-pane label="③同步支付宝门店">
          <div
            class="operbtn"
            style="width: 100%; color: rgb(0 156 216)"
            @click="syncShop()"
          >
            同步支付宝门店
          </div>
        </el-tab-pane>
      </el-tabs>
    </el-dialog>
    <!-- 新蓝海 -->
    <el-dialog
      v-dialogDrag
      title="新蓝海/快销直通车"
      :visible.sync="newlanhai"
      width="50%"
      :close-on-click-modal="false"
    >
      <div v-if="alilanhaival == 4" class="reds">
        驳回原因：{{ newlanhaiinfo.applyMsg }}
      </div>
      <el-form
        status-icon
        ref="tarminal"
        label-width="150px"
        class="demo-dynamic"
      >
        <el-form-item label="活动场景">
          <el-radio-group
            v-model="newlanhaiinfo.applyType"
            @change="newlanhaitype"
            :disabled="newlanhaidisabled"
          >
            <el-radio :label="1">餐饮新蓝海</el-radio>
            <el-radio :label="2">快销直通车</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="行业类目">
          <el-select
            class="width100"
            v-model="newlanhaiinfo.applyMcc"
            placeholder="请选择行业类目"
            @change="mccchange"
            :disabled="newlanhaidisabled"
          >
            <el-option
              v-for="(item, index) in mcclist"
              :key="index"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="地址">
          <div id="app">
            <el-cascader
              class="width100"
              size="large"
              :options="options"
              v-model="newlanhaiinfo.selectedOptions"
              @change="handleChange"
            >
            </el-cascader>
          </div>
        </el-form-item>
        <el-form-item label="详细地址">
          <el-input
            type="text"
            v-model.trim="newlanhaiinfo.address"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item label="资质证明材料类型">
          <el-select
            class="width100"
            v-model="newlanhaiinfo.licImageType"
            placeholder="请选择资质证明材料类型"
          >
            <el-option
              v-for="(item, index) in materialslist"
              :key="index"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-upload
            list-type="picture-card"
            :action="upload"
            :headers="token"
            :show-file-list="false"
            :on-progress="logadings"
            :on-success="statusphoto"
          >
            <img
              style="width: 100%; height: 100%"
              v-if="newlanhaiinfo.licImageUrl"
              :src="newlanhaiinfo.licImageUrl"
              class="avatar"
            />
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
          <div>资质证明材料</div>
        </el-form-item>
        <el-form-item class="photo">
          <el-upload
            list-type="picture-card"
            :action="upload"
            :headers="token"
            :show-file-list="false"
            :on-progress="logadings"
            :on-success="pOutside"
          >
            <img
              style="width: 100%; height: 100%"
              v-if="newlanhaiinfo.outsideUrl"
              :src="newlanhaiinfo.outsideUrl"
              class="avatar"
            />
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
          <div>外部门头照</div>
        </el-form-item>
        <el-form-item class="photo">
          <el-upload
            list-type="picture-card"
            :action="upload"
            :headers="token"
            :show-file-list="false"
            :on-progress="logadings"
            :on-success="pInside"
          >
            <img
              style="width: 100%; height: 100%"
              v-if="newlanhaiinfo.insideUrl"
              :src="newlanhaiinfo.insideUrl"
              class="avatar"
            />
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
          <div>内部环境照</div>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="newlanhai = false">取消</el-button>
        <el-button type="primary" @click="newlanhaiok()">确定</el-button>
      </span>
    </el-dialog>
    <!-- 定制数据编辑窗 -->
    <el-dialog
      v-dialogDrag
      :title="updCustPropTitle"
      :visible.sync="custProp"
      width="35%"
      :close-on-click-modal="false"
    >
      <el-form class="demo-dynamic">
        <el-form-item>
          <el-input
            type="text"
            v-model.trim="merchantinfo.alias"
            autocomplete="off"
            @input="updMerCustCheck"
          ></el-input>
        </el-form-item>
      </el-form>
      <div style="width: 100%; text-align: right; margin-top: 30px">
        <el-button
          type="primary"
          @click="
            custProp = false;
            merchantinfo.alias = oldMerInfo.alias;
            updMerCustFlag = true;
          "
          >取消
        </el-button>
        <el-button
          type="primary"
          :disabled="updMerCustFlag"
          @click="updMerCustProp"
          >确定</el-button
        >
      </div>
    </el-dialog>
    <!-- 流量包 -->
    <el-dialog
      v-dialogDrag
      title="流量包"
      :visible.sync="merPoint"
      width="35%"
      :close-on-click-modal="false"
    >
      <el-form class="demo-dynamic">
        <el-form-item :required="true" label="充值比例（万分比）">
          <el-input
            type="text"
            v-model.trim="addMerPoint.limitRatio"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item :required="true" label="充值系数（可精确到两位小数）">
          <el-input
            type="text"
            v-model.trim="addMerPoint.limitMul"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item :required="true" label="预警阈值">
          <el-input
            type="text"
            v-model.trim="addMerPoint.warnValue"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item label="预警邮箱">
          <el-input
            type="text"
            v-model.trim="addMerPoint.warnMail"
            autocomplete="off"
          ></el-input>
        </el-form-item>
      </el-form>
      <div style="width: 100%; text-align: right; margin-top: 30px">
        <el-button type="primary" @click="merPoint = false">取消</el-button>
        <el-button type="primary" @click="openMerPoint">确定</el-button>
      </div>
    </el-dialog>
    <!-- 优惠券通道 -->
    <el-dialog
      v-dialogDrag
      title="添加优惠券通道"
      :visible.sync="codeChannelVisible"
      width="45%"
      :close-on-click-modal="false"
    >
      <el-form status-icon ref="channelarr" class="demo-dynamic">
        <el-form-item label="通道">
          <el-select
            class="servicelevel"
            v-model="codeInfo.channelType"
            @change="changeCode"
            placeholder="选择通道"
          >
            <el-option
              v-for="item in allCodeList"
              :key="item.code"
              :label="item.options"
              :value="item.code"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="codeChannelVisible = false">取消</el-button>
        <el-button type="primary" @click="sub">确定</el-button>
      </span>
    </el-dialog>

    <el-dialog
      title="汇付业务开通"
      :visible.sync="businessConfigVisible"
      width="600px"
      :close-on-click-modal="false"
    >
     <el-tabs v-model="huifuConfigAcitv" style="margin-top:-20px;">
          <el-tab-pane label="余额分账" name="1">
            <div class="open-accounts">
           <el-form label-position="top" status-icon ref="balancePayFormRef" :rules="balancePayFormRules"  :model="balancePayForm" >
             <el-form-item prop="fee_rate" label="手续费%">
                 <el-input
                   type="number"
                   v-model.trim="balancePayForm.fee_rate"
                   placeholder="请输入手续费（百分比）"
                 ></el-input>
             </el-form-item>
             <el-form-item prop="fee_fix_amt" label="固定手续费（元）">
                 <el-input
                   type="number"
                   v-model.trim="balancePayForm.fee_fix_amt"
                   placeholder="请输入固定手续费"
                 ></el-input>
             </el-form-item>
             <el-form-item prop="out_fee_flag" label="交易手续费扣款类型">
               <el-select
                 class="servicelevel"
                 v-model="balancePayForm.out_fee_flag"
                 @change="changeFeeFlag"
                 placeholder="请选择交易手续费扣款类型"
               >
                 <el-option label="内扣" value="2"></el-option>
                 <el-option label="外扣" value="1"></el-option>
               </el-select>
             </el-form-item>
             <el-form-item prop="out_fee_huifuid" v-if="balancePayForm.out_fee_flag == 1" label="手续费外扣汇付ID">
                 <el-input
                   type="number"
                   v-model.trim="balancePayForm.out_fee_huifuid"
                   placeholder="请输入手续费外扣汇付ID"
                 ></el-input>
             </el-form-item>
             <el-form-item prop="charge_mode" label="扣费模式" v-if="balancePayForm.out_fee_flag">
               <el-select
                 class="servicelevel"
                 v-model="balancePayForm.charge_mode"
                 placeholder="请选择扣费模式"
               >
                 <el-option
                   v-for="item in deductionList"
                   :key="item.value"
                   :label="item.label"
                   :value="item.value"
                 ></el-option>
               </el-select>
             </el-form-item>
             <el-form-item prop="balance_model" label="业务模式">
               <el-select
                 class="servicelevel"
                 v-model="balancePayForm.balance_model"
                 placeholder="请选择业务模式"
               >
                 <el-option
                   v-for="item in balanceList"
                   :key="item.value"
                   :label="item.label"
                   :value="item.value"
                 ></el-option>
               </el-select>
             </el-form-item>
             <el-form-item prop="description_info.busi_instruction"  label="业务模式说明">
                 <el-input
                   type="textarea"
                   v-model.trim="balancePayForm.description_info.busi_instruction"
                   placeholder="请输入业务模式说明"
                   maxlength="500"
                   show-word-limit
                   rows="3"
                 ></el-input>
             </el-form-item>
             <el-form-item prop="description_info.capital_instruction"  label="资金流向说明">
                 <el-input
                   type="textarea"
                   v-model.trim="balancePayForm.description_info.capital_instruction	"
                   placeholder="请输入资金流向说明"
                   maxlength="500"
                   show-word-limit
                   rows="3"
                 ></el-input>
             </el-form-item>
             <el-form-item prop="description_info.function_instruction"  label="功能开通用途说明">
                 <el-input
                   type="textarea"
                   v-model.trim="balancePayForm.description_info.function_instruction"
                   placeholder="请输入功能开通用途说明"
                   maxlength="500"
                   rows="3"
                   show-word-limit
                 ></el-input>
             </el-form-item>
             <el-row>
               <el-col :span="12" style="display:flex; justify-content:center;"> 
                 <el-form-item prop="F449Url"  label="入驻合作协议">
                  <el-upload
                     :action="uploadUrl"
                     :headers="token"
                       :show-file-list="false"
                       :on-success="doorUpLoadSuccess"
                       :before-upload="beforeUploadImgF449"
                       >
                       <img v-if="balancePayForm.F449Url" :src="balancePayForm.F449Url" class="avatar">
                       <img class="avatar-none" v-else src="https://dashboard.huifu.com/member/static/img/default-doc.svg" alt="">
                 </el-upload>
                </el-form-item>
               </el-col>
               <el-col :span="12" style="display:flex; justify-content:center;"> 
                 <el-form-item prop="F447Url"  label="交易双方历史合作项目流水证明">
                  <el-upload
                     :action="uploadUrl"
                     :headers="token"
                       :show-file-list="false"
                       :on-success="doorUpLoadSuccessF447"
                       :before-upload="beforeUploadImgF447"
                       >
                       <img v-if="balancePayForm.F447Url" :src="balancePayForm.F447Url" class="avatar">
                       <img class="avatar-none" v-else src="https://dashboard.huifu.com/member/static/img/default-doc.svg" alt="">
                 </el-upload>
                </el-form-item>
               </el-col>
             </el-row>
            </el-form>
           </div>
          </el-tab-pane>
          <el-tab-pane label="微信支付" name="2">
            <el-form label-position="top" status-icon ref="wxConfigurationFormRef" :rules="wxConfigurationFormRules"  :model="wxConfigurationForm" >
               <el-form-item prop="pay_scene" label="支付场景">
                 <el-select
                   class="servicelevel"
                   v-model="wxConfigurationForm.pay_scene"
                   @change="changeCode"
                   placeholder="请选择支付场景"
                 >
                   <el-option
                     v-for="item in paySceneList"
                     :key="item.value"
                     :label="item.label"
                     :value="item.value"
                   ></el-option>
                 </el-select>
               </el-form-item>
               <el-form-item prop="mccList" label="商户经营类目" style="width:100%">
                 <el-cascader
                 style="width:100%"
                       v-model="wxConfigurationForm.mccList"
                       :options="huifuMccList"
                       :props="mccProps"
                       @change="geRegionChange">
                 </el-cascader>
               </el-form-item>
               <el-form-item prop="fee_rate" label="手续费%">
                   <el-input
                     type="number"
                     v-model.trim="wxConfigurationForm.fee_rate"
                     placeholder="请输入手续费（百分比）"
                   ></el-input>
               </el-form-item>
           </el-form>
          </el-tab-pane>
          <el-tab-pane label="支付宝支付" name="3">
            <el-form label-position="top" status-icon ref="aliConfigurationFormRef" :rules="aliConfigurationFormRules"  :model="aliConfigurationForm" >
              <el-form-item prop="pay_scene" label="支付场景">
                <el-select
                  class="servicelevel"
                  v-model="aliConfigurationForm.pay_scene"
                  @change="changeCode"
                  placeholder="请选择支付场景"
                >
                  <el-option
                    v-for="item in aliPaySceneList"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item prop="fee_rate" label="手续费%">
                  <el-input
                    type="number"
                    v-model.trim="aliConfigurationForm.fee_rate"
                    placeholder="请输入手续费（百分比）"
                  ></el-input>
              </el-form-item>
            </el-form>
          </el-tab-pane>
      </el-tabs>
      <span slot="footer" class="dialog-footer">
        <el-button @click="businessConfigVisible = false">取消</el-button>
        <el-button type="primary" @click="businessConfigClick" :loading="businessConfigLoading">确定</el-button>
      </span>
    </el-dialog>

  </section>
</template>

<script>
const StarChannelTypes = [
  "aliChannelType",
  "bankChannelType",
  "bestpayChannelType",
  "ecnyChannelType",
  "longpayChannelType",
  "uniChannelType",
  "wxChannelType",
];
import $ from "jquery";
import { channeldetail, channeldetailupdate , getTopMccByType } from "@/api/api";
import VueQRCode from "qrcodejs2";
var QRCode = require("qrcode");
import axios from "axios";
import {
  PAPIaddCPlatform,
  getRegistryChannnel,
  merchantdetails,
  channel,
  channelget,
  updatewx,
  ratelist,
  updaterate,
  aliupdaterate,
  uniupdaterate,
  bestpayupdaterate,
  ecnyupdaterate,
  longpayupdaterate,
  getSettlement,
  channelselect,
  channelselects,
  divideChannelList,
  updatechannel,
  applist,
  updatesettlement,
  alipayauth,
  addbank,
  updateBankRate,
  deletechannel,
  addchannels,
  registerQiMai,
  wechatRegistry,
  elecContractSign,
  updateali,
  getdimensionTagList,
  getSelectTagsByRole,
  postDimensionTagSave,
  setGreenStatus,
  setBlueStatus,
  appsave,
  postDimensionTagRemove,
  allmerchantlist,
  chaindetail,
  chainupdate,
  chainclose,
  chainsubs,
  splitinfo,
  splitconfigt,
  splitopen,
  paycfg,
  operationresult,
  operationapply,
  syncShop,
  blueSeaquery,
  blueSeaapply,
  blueSeamodify,
  appremove,
  updMerCustProp,
  openMerPoint,
  getRegistryCouponChannel,
  getChannelSelect,
  postChannelSelect,
  confirmSplitConfig,
  getQuota, //获取额度包数据
  updateQuota, //配置额度包
  APIrelatedStarPostPayment, //关联星驿付
  merchantDpayUrl,
  channelCommit
} from "@/api/api";
import { huifuBusiBind } from '@/api/fetchApi'
import {
  provinceAndCityData,
  regionData,
  provinceAndCityDataPlus,
  regionDataPlus,
  CodeToText,
  TextToCode,
} from "element-china-area-data";
import { forEach } from "jszip";
import { dlimitMccList } from '@/utils/huifuMcc'
export default {
  // name: "baseform",
  data() {
    return {
      huifuConfigAcitv:"1",
      businessConfigLoading:false,
      businessConfigVisible:false,
      accountsLoading:false,
      accountsForm:{
        div_flag:'Y',
        rule_origin:'01',
        apply_ratio:100.00,
        start_type:'1',
        split_fee_rate:'',
        per_amt:'',
        scene:'',
        huifu_id:'',
        split_ext_info:{
          busi_instruction:'',
          capital_instruction:'',
          function_instruction:''
        },
      },
      aliConfigurationVisible:false,
      aliConfigLoading:false,
      aliConfigurationForm:{
        pay_scene:'',
        fee_rate:''
      },
      aliConfigurationFormRules:{
        pay_scene:[{ required: true, message: '请选择支付场景', trigger: 'change' }],
        fee_rate:[{ required: true, message: '请输入手续费', trigger: 'change' }],
      },
      balancePayVisible:false,
      balancePayLoading:false,
      balancePayForm:{
        fee_rate:null,
        fee_fix_amt:null,
        out_fee_flag:null,
        out_fee_huifuid:null,
        charge_mode:null,
        balance_model:null,
        huifuUrl:'',
        description_info:{
          busi_instruction:'',
          capital_instruction:'',
          function_instruction:''
        }
      },
      deductionList:[],
      balancePayFormRules:{
        fee_rate:[{ required: true, message: '请输入手续费', trigger: 'change' }],
        fee_fix_amt:[{ required: true, message: '请输入固定手续费', trigger: 'change' }],
        out_fee_flag:[{ required: true, message: '请选择交易手续费扣款类型', trigger: 'change' }],
        out_fee_huifuid:[{ required: true, message: '请输入手续费外扣汇付ID', trigger: 'change' }],
        charge_mode:[{ required: true, message: '请选择扣费模式', trigger: 'change' }],
        balance_model:[{ required: true, message: '请选择业务模式', trigger: 'change' }],
        'description_info.busi_instruction':[{ required: true, message: '请输入业务模式说明', trigger: 'change' }],
        'description_info.capital_instruction':[{ required: true, message: '请输入资金流向说明', trigger: 'change' }],
        'description_info.function_instruction':[{ required: true, message: '请输入功能开通用途说明', trigger: 'change' }],
        F449Url:[{required: true, validator:(rule , value , callback)=>{
                    if(this.balancePayForm.F449Url){
                        callback();
                    }else{
                        callback(new Error('请上传入驻合作协议！'))
                    }
                 } }],
        F447Url:[{required: true, validator:(rule , value , callback)=>{
            if(this.balancePayForm.F447Url){
                callback();
            }else{
                callback(new Error('请上传交易双方历史合作项目流水证明！'))
            }
         } }],
      },
      wxConfigLoading:false,
      wxConfigurationVisible:false,
      wxConfigurationForm:{
        pay_scene:'',
        mccList:[],
        mcc:'',
        fee_rate:'',
        is_check_real_name:'N',
      },
      wxConfigurationFormRules:{
        pay_scene:[{ required: true, message: '请选择支付场景', trigger: 'change' }],
        mccList:[{ required: true, message: '请选择商户经营类目', trigger: 'change' }],
        fee_rate:[{ required: true, message: '请输入手续费', trigger: 'change' }],
      },
      huifuMccList:dlimitMccList,
      balanceList:[ { value:'2' , label:'入驻商户货款（周期性结算）' } , { value:'3' , label:'营销补贴（周期性结算）' } , { value:'4' , label:'推广方（渠道/代理/个人）的服务佣金/抽成' } , { value:'5' , label:'红包发放' } ,{ value:'6' , label:'钱包功能' },{ value:'7' , label:'其他模式' }],
      paySceneList:[ { value:'1' , label:'线下反扫' } , { value:'2' , label:'线下公众号' } , { value:'3' , label:'线下小程序' } , { value:'4' , label:'线上公众号' }  , { value:'5' , label:'线上小程序' } , { value:'6' , label:'教培行业' } , { value:'8' , label:'教育K12' } , { value:'10' , label:'非盈利费率' }  , { value:'11' , label:'保险费率' }, { value:'12' , label:'线上反扫' } ],
      aliPaySceneList:[ { value:'1' , label:'线下扫码' } , { value:'2' , label:'线上扫码' } , { value:'3' , label:'非盈利费率' }],
      sceneList:[ { value:'00' , label:'其他' } , { value:'01' , label:'医美医院分账' } , { value:'A1' , label:'教培机构分账' } , { value:'A2' , label:'公办/民办学校分账' } , { value:'A3' , label:'医美渠道独立收款分账' } , { value:'A4' , label:'线上供应商货款' } , { value:'A5' , label:'线上推广方（渠道/代理/个人）的服务佣金/抽成' } , { value:'A7' , label:'入驻商户货款' } , { value:'A8' , label:'线下供应商货款' } , { value:'A9' , label:'线下推广方' } , { value:'A10' , label:'个人与合作方分账' } ],
      openAccountsVisible:false,
      addCPlatformBtnShow: false,
      checkboxGroup5: [],
      channerlists: [],
      CPlatformvisible: false,
      change_channel_value: "", //切换通道的通道类型
      avail_quota: "", //可用额度包
      quota: "", //额度包
      residualQuota: "", //已用额度
      codeChannelVisible: false,
      channelNameArr: [],
      codeList: [],
      allCodeList: [],
      options: regionData,
      token: { token: sessionStorage.getItem("token") },
      uploadUrl: process.env.VUE_APP_BASE_URL + `/product/v31/api/merchant/upload/`,
      upload:
        process.env.VUE_APP_BASE_URL +
        "/product/v31/api/merchant/uploadfile/upload",
      url:
        process.env.VUE_APP_BASE_URL + "/product/v31/api/merchant/split/config",
      merchantinfo: {},
      oldMerInfo: {},
      merchantno: "",
      channelinfo: [],
      visible: false,
      alivisible: false,
      attention: false,
      rate: false,
      changechannel: false,
      checkout: false,
      aliBox: false,
      banks: false,
      cost: false,
      bill: false,
      addchannel: false,
      signingBox: false,
      rateswitch: true,
      mchiddis: true,
      wecharlvzhou: false,
      alilanhai: false,
      alilanhaival: "",
      applyMsg: "",
      zongfendian: false,
      fenzhang: false,
      textQrCodeId: "",
      showQRCode: false,
      qrcode: null,
      jurisdiction: false,
      ratetype: "",
      channellist: "",
      channellists: "",
      userinfo: "",
      invoices: {
        num: "",
      },
      wxlists: {
        appidList: [],
      },
      appidLists: [],
      jspathLists: [],
      appurl: [],
      appid: [],
      Settlement: [],
      channeltypes: "",
      paydeploys: "",
      settlementtype: "",
      alipayautharr: "",
      ratenum: "",
      channelrate: "",
      merarr: [],
      wxchannelboxinfo: {},
      alichannelboxinfo: {},
      costs: {
        creditcardProfitRate: "",
        debitcardProfitRate: "",
        debitcardTopFee: "",
      },
      bank: {
        mchId: "",
      },
      ratearr: {
        ratenum: "",
        wxratenum: "",
        uniratenum: "",
      },
      ratelists: "",
      ChannelName: "",
      channelarr: {
        ratenum: "",
        wxSettlement: "",
        aliSettlement: "",
        channelid: "",
        channelName: "",
      },
      accountsFormRules:{
        split_fee_rate:[{ required: true, message: '请输入手续费', trigger: 'change' }],
        per_amt:[{ required: true, message: '请输入固定手续费', trigger: 'change' }],
        scene:[{ required: true, message: '请选择分账模式', trigger: 'change' }],
        'split_ext_info.busi_instruction':[{ required: true, message: '请输入业务模式说明', trigger: 'change' }],
        'split_ext_info.capital_instruction':[{ required: true, message: '请输入资金流向说明', trigger: 'change' }],
        'split_ext_info.function_instruction':[{ required: true, message: '请输入功能开通用途说明', trigger: 'change' }],
      },
      paydeploy: {
        mchId: "",
        wxMchId: "",
        wxMode: "",
        miniAppid: "",
        // longpaySmid: "",
        // longpayBranchId: "",
        // longpayOperatorId: "",
        // longpayOperatorPw: "",
        // longpayCertPw: "",
        // longpayPostId: "",
        // longpayPublicKey: "",
        wxAppid: "",
        wxAppsecret: "",
        urltype: "http://",
        url: "",
        appAppid: "",
      },
      addappid: {
        payappid: "",
        attentionid: "",
      },
      addurls: {
        jsapipath: "",
      },
      setupshops: {
        type: "-1",
        openTime: "",
        closeTime: "",
        permissions: "",
        lines: "",
        pid: "-1",
        polling: "0",
        dianming: "",
      },
      switchchannel:false,
      merchantName: "",
      adm_tag: [], //超管 运营标签
      cw_tag: [], //财务标签
      fws_tag: [], //服务商标签
      tag_color: "", //标签颜色
      Channeldeploy1: false, //添加标签穿梭框开关
      unUsedTags: [], //添加标签穿梭框 未选择的标签
      usedTags: [], //添加标签穿梭框 已选择的标签
      rolesId: "",
      oeminfo: "",
      oemFlag: "",
      fenzhangData: [],
      fendianarr: [],
      fenzhangs: {},
      servicearr: [],
      mchId: "",
      payinfo: {},
      threebinding: false,
      operationapplybtn: true,
      operationresultbtn: true,
      syncShopbtn: true,
      alipayAccount: "",
      batchNo: "",
      newlanhai: false,
      newlanhaiinfo: {
        applyType: "",
        applyMcc: "",
        licImageType: "",
        address: "",
        outsideUrl: "",
        insideUrl: "",
        licImageUrl: "",
        selectedOptions: [],
      },
      mcclist: [],
      materialslist: [],
      newlanhaidisabled: false,
      wxminiprogram: false,
      updCustPropTitle: "",
      custProp: false,
      updMerCustFlag: true,
      merPoint: false,
      quotaPoint: false,
      dialogFormVisible: false,
      addMerPoint: {},
      codeInfo: {},
      channelName: "",
      accountLoading: false,
      StarPostPaymentShow: false, //关联星驿付
      payTypeTitle: "",
      huifuMccList:[],
      mccProps:{
              lazy: true,
              value:'id',
              label:'mcc1Name',
              lazyLoad(node, resolve){
                console.log(node)
                let  level = node.level + 1
                setTimeout(async ()=>{
                  const res = await getTopMccByType({parentId:node.value,channelType:'16',level:level})
                  res.data.forEach(item=>{
                    if(node.level == 1){
                      item.mcc1Name = item.mcc2Name
                    }else{
                      item.mcc1Name = item.mcc3Name
                      item.leaf = 1
                    }
                  })
                  resolve(res.data);
                },1)
              }
            },
    };
  },
  watch: {
    codeChannelVisible: function () {
      // console.log(arguments);
    },
  },
  created() {
    this.userinfo = JSON.parse(sessionStorage.getItem("userInfo"));
    this.merchantno = sessionStorage.getItem("merchants_id");
    // this.merchantName = JSON.parse(sessionStorage.getItem("merchants_merchantName"))
    this.merchantdetails();
    this.getQuotaState();
    // this.channel()
    // this.channleitem()
    var aaa = sessionStorage.getItem("userInfo");
    var bbb = JSON.parse(aaa);
    this.rolesId = bbb.rolesId;
    if (
      this.rolesId == 1 ||
      this.rolesId == 2 ||
      this.rolesId == 8 ||
      this.rolesId == 9
    ) {
      this.getdimensionTagList(); //获取指定对象已拥有的标签
    }
    // 判断是否是oem
    this.oeminfo = JSON.parse(sessionStorage.getItem("oeminfo"));
    this.oemFlag = sessionStorage.getItem("oemFlag");
    this.getCodeChannel();
    this.initGetTopMccByType()
  },
  methods: {
    async initGetTopMccByType(parentId,level){
        const res = await getTopMccByType({channelType:'16',level:1})
        this.huifuMccList = res.data
    },
    //创建商户平台按钮
    addCPlatformBtn() {
      this.CPlatformvisible = true;
      this.getRegistryChannnel();
    },
    funChanne(id){
      const safetyStatusList = [ { value:0,lable:'未绑定' } , { value:1,lable:'已绑定' } , { value:2,lable:'待鉴权' } ] 
      const remittanceStatusList = [ { value:1,lable:'正常' } , { value:3,lable:'关闭' } , { value:4,lable:'冻结' } , { value:5,lable:'销户' } ] 
      let data = {}
      if(id == 31){  // 平安
         data =  safetyStatusList.find(item=> item.value == this.merchantinfo.walletStatus)
         if(data){
          return data.value == 1 ? '已开通' :'未开通'
         }
      }else{  // 汇付
        data =  remittanceStatusList.find(item=> item.value == this.merchantinfo.walletStatus)
        if(data){
          return data.value == 1 ? '已开通' :'未开通'
         }
      }
      return data.lable
    },
    addCPlatform() {
      // console.log("111111111111111", this.checkboxGroup5);
      if (this.checkboxGroup5) {
        PAPIaddCPlatform(this.checkboxGroup5, this.merchantinfo.id).then(
          (res) => {
            if (res.code == 405) {
              sessionStorage.removeItem("token");
              this.$router.push("/login");
            } else if (res.code == 200) {
              this.$message({
                message: "成功",
                type: "success",
              });
              this.CPlatformvisible = false;
            } else {
              this.$message.error(res.message);
            }
          }
        );
      } else {
        this.$message.error("请选择通道");
      }
    },
    //  获取可选渠道
    getRegistryChannnel() {
      getRegistryChannnel({}, this.merchantinfo.id).then((res) => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          //    console.log(res)
          this.channerlists = res.data;
        } else {
          this.$message.error(res.message);
        }
      });
    },
    // determine(val) {
    //   console.log("111111111111111", this.checkboxGroup5.toString());
    //   const loading = this.$loading({
    //     lock: true,
    //     text: "Loading",
    //     spinner: "el-icon-loading",
    //     background: "rgba(0, 0, 0, 0.7)",
    //   });
    //   if (this.checkboxGroup5.toString()) {
    //     merchantreview(
    //       {
    //         status: this.state,
    //         reviewedReason: this.note,
    //         channelIds: this.checkboxGroup5.toString(), //通道类型改通道id channelTypes——channelIds
    //       },
    //       this.merchantinfo.id
    //     ).then((res) => {
    //       // console.log(res);
    //       if (res.code == 405) {
    //         sessionStorage.removeItem("token");
    //         this.$router.push("/login");
    //       } else if (res.code == 200) {
    //         this.$message({
    //           message: "成功",
    //           type: "success",
    //         });
    //         this.$router.push({
    //           path: "/audit",
    //         });
    //         this.$router.go(0);
    //         loading.close();
    //       } else {
    //         loading.close();
    //         this.$message.error(res.message);
    //       }
    //     });
    //   } else {
    //     loading.close();
    //     this.$message.error("请选择通道");
    //   }
    // },
    //关联星驿付按钮
    showStarPostPaymentButton(typeArray) {
      for (let key in typeArray) {
        if (StarChannelTypes.some((itm) => itm == key) && typeArray[key] == 45)
          return (this.StarPostPaymentShow = true);
        this.StarPostPaymentShow = false;
      }
    },
    // 关联星驿付
    relatedStarPostPayment() {
      APIrelatedStarPostPayment(this.merchantno).then(
        // APIrelatedStarPostPayment(1804).then(
        (res) => {
          if (res.code === 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code === 200) {
            this.$message({
              message: "关联成功",
              type: "success",
            });
          } else {
            this.$message.error(res.message);
          }
        }
      );
    },
    //获取额度包数据
    getQuotaState() {
      getQuota(this.merchantno).then((res) => {
        if (res.code === 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code === 200) {
          this.quota = (res.data.quota / 100).toFixed(2);
          this.avail_quota = (res.data.availQuota / 100).toFixed(2);
        } else {
          this.$message.error(res.message);
        }
      });
    },
    //额度包配置
    configureQuota() {
      updateQuota(this.merchantno, { quota: this.quota }).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.getQuotaState();
          this.$message({
            message: "修改成功",
            type: "success",
          });
          this.quotaPoint = false;
        } else {
          this.$message.error(res.message);
        }
      });
    },
    //配置额度包
    popupQuotaPoint() {
      this.quotaPoint = true;
      getQuota(this.merchantno).then((res) => {
        if (!res.code === 200) return this.$message.error(res.message);
        let date = res.data;
        this.quota = (date.quota / 100).toFixed(2);
        this.residualQuota = (date.residualQuota / 100).toFixed(2);
      });
    },
    async aisleSumbit(v){
       const res = await channelCommit({merchantChannelId:v.id})
       if(res.code == 200){
        this.$message.success('提交成功！')
        this.channel()
       }else{
        this.$message.error(res.message);
       }
    },
    businessConfig(v){
        this.huifuConfigId = v.mchId
       this.businessConfigVisible = true
    },
    businessConfigClick(){
       if(this.huifuConfigAcitv == 1){
          this.openBalancePayClick()
       }else if(this.huifuConfigAcitv == 2){
          this.openWxConfigClick()
       }else if( this.huifuConfigAcitv == 3 ){
          this.openAliConfigClick()
       }else{

       }
    },
    // 商户优惠券详情
    codeDetail(channelId, merchantId) {
      this.$router.push({
        name: "Codecustom",
        query: {
          channelId,
          merchantId,
        },
      });
    },
    // 获取商户所属优惠券通道
    async getCodeChannel() {
      const res = await getChannelSelect(this.merchantno);
      if (res.code === 405) {
        sessionStorage.removeItem("token");
        this.$router.push("/login");
      } else {
        if (res.code === 200) {
          this.codeList = res.data;
        } else {
          this.$message.error(res.message);
        }
      }
    },
    // 弹出优惠券通道配置
    async showCodeChannel() {
      // console.log("00", this.codeChannelVisible);
      this.codeChannelVisible = true;
      const res = await getRegistryCouponChannel(this.merchantno);
      if (res.code === 200) {
        this.allCodeList = res.data;
      } else {
        this.$message.error(res.message);
      }
    },
    changeFeeFlag(v){
      this.balancePayForm.charge_mode = ''
      if(v == 1){
        this.deductionList = [ { value:'10',label:'指定承担方'},{ value:'11',label:'出款方承担'},{ value:'12',label:'交易时指定承担方'} ]
      }else{
        this.deductionList = [ { value:'01',label:'默认规则'},{ value:'02',label:'收款方分摊'},{ value:'03',label:'交易时指定承担方'} ]
      }
    },
    // 优惠券下拉框赋值
    changeCode(val) {
      this.allCodeList.forEach((ele) => {
        if (ele.code === val) {
          this.channelName = ele.options;
        }
      });
    },
    // 添加优惠券通道
    async sub() {
      // console.log(this.channelName);
      const res = await postChannelSelect({
        merchantId: this.merchantno,
        channelName: this.channelName,
        channelType: this.codeInfo.channelType,
      });
      if (res.code === 405) {
        sessionStorage.removeItem("token");
        this.$router.push("/login");
      } else {
        if (res.code === 200) {
          this.$message.success("操作成功！");
          this.getCodeChannel();
          this.codeChannelVisible = false;
        } else {
          this.$message.error(res.message);
          this.codeChannelVisible = false;
        }
      }
    },
    //修改thead 背景色
    tableHeaderColor({ row, column, rowIndex, columnIndex }) {
      if (rowIndex === 0) {
        return "background-color: #F0F0F0;font-weight: 500;font-size:14px;color:#000;";
      }
    },
    channeHeaderColor({ row, column, rowIndex, columnIndex }) {
      if (rowIndex === 0) {
        return "font-size:14px;color:#4e5969;font-weight: 400;";
      }
    },
    //   微信关注配置添加
    addappids() {
      var payarr = [];
      for (var i = 0; i < this.appidLists.length; i++) {
        payarr.push(this.appidLists[i].subappid);
      }
      // if(this.addappid.payappid == '' || this.addappid.attentionid == ''){   //2个都必填
      if (this.addappid.payappid == "") {
        this.$message.error("请输入appid");
      } else {
        if (payarr.indexOf(this.addappid.payappid) == -1) {
          // 判断填写的是否重复
          this.wxlists.appidList.push({
            subappid: this.addappid.payappid,
            subscribeappid: this.addappid.attentionid,
            delete: 1,
          });
          this.appidLists.push({
            subappid: this.addappid.payappid,
            subscribeappid: this.addappid.attentionid,
            delete: 1,
          });
          this.addappid.attentionid = "";
          this.addappid.payappid = "";
        } else {
          this.$message.error("appid重复");
        }
      }
    },
    renderheader(h, { column, $index }) {
      return h("span", {}, [
        h("span", {}, column.label.split("?")[0]),
        h("br"),
        h("span", {}, column.label.split("?")[1]),
      ]);
    },
    //   微信关注配置添加支付授权
    addurl() {
      var urlarr = [];
      for (var i = 0; i < this.jspathLists.length; i++) {
        urlarr.push(this.jspathLists[i].jsapipath);
      }
      if (this.paydeploy.url == "") {
        this.$message.error("请输入支付授权目录");
      } else {
        if (urlarr.indexOf(this.paydeploy.urltype + this.paydeploy.url) == -1) {
          this.wxlists.jspathList.push({
            jsapipath: this.paydeploy.urltype + this.paydeploy.url,
            delete: 1,
          });
          this.jspathLists.push({
            jsapipath: this.paydeploy.urltype + this.paydeploy.url,
            delete: 1,
          });
          this.paydeploy.url = "";
        } else {
          this.$message.error("支付授权目录重复");
        }
      }
    },
    // 微信关注配置删除支付授权
    delurl(index, rows, num) {
      rows.splice(index, 1);
      this.jspathLists.splice(index - num, 1);
    },
    //   微信关注配置删除
    deleteRow(index, rows, num) {
      rows.splice(index, 1);
      this.appidLists.splice(index - num, 1);
    },
    geRegionChange(v){
      this.wxConfigurationForm.mcc = v[2] 
    },
    // 详情
    merchantdetails(channle) {
      merchantdetails({}, this.merchantno).then((res) => {
        // console.log("res", res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          // console.log(
          //   res.data.aliChannelType +
          //     "--" +
          //     res.data.wxChannelType +
          //     "--" +
          //     res.data.bestpayChannelType
          // );
          this.showStarPostPaymentButton(res.data);

          // this.longId = res.data.aliChannelId;
          this.merchantName = res.data.merchantName;
          this.merchantinfo = res.data;

          // 测试二维码
          this.textQrCodeId = res.data.merchantNo;
          this.channelarr.wxChannelId = res.data.wxChannelId;
          this.channelarr.aliChannelId = res.data.aliChannelId;
          this.channelarr.bestpayChannelId = res.data.bestpayChannelId;
          this.channelarr.wxSettlement = res.data.wxSettlement;
          this.channelarr.aliSettlement = res.data.aliSettlement;
          this.bank.mchId = res.data.merchantNoUni;
          this.costs.creditcardProfitRate = (
            res.data.creditcardProfitRate / 10
          ).toFixed(3);
          this.costs.debitcardProfitRate = (
            res.data.debitcardProfitRate / 10
          ).toFixed(3);
          this.costs.debitcardTopFee = (res.data.debitcardTopFee / 100).toFixed(
            3
          );
          // 支付配置
          this.merchantinfo.bankSwitch = "1";
          this.payinfo = {
            aliborc: res.data.aliTradeSwitch.substring(0, 1),
            alicorb: res.data.aliTradeSwitch.substring(2, 3),
            alirefund: res.data.aliTradeSwitch.substring(4, 5),
            wxborc: res.data.wxTradeSwitch.substring(0, 1),
            wxcorb: res.data.wxTradeSwitch.substring(2, 3),
            wxrefund: res.data.wxTradeSwitch.substring(4, 5),
            uniborc: res.data.uniTradeSwitch.substring(0, 1),
            unicorb: res.data.uniTradeSwitch.substring(2, 3),
            unirefund: res.data.uniTradeSwitch.substring(4, 5),
            bankborc: res.data.bankTradeSwitch.substring(0, 1),
            bankrefund: res.data.bankTradeSwitch.substring(4, 5),
          };
          // 查询新蓝海状态
          this.batchNo = res.data.aliBatchNo;
          this.alilanhaival = res.data.blueseaStatus;
          if (res.data.blueseaStatus == 1) {
            blueSeaquery({
              channelId: res.data.aliChannelId,
            }).then((res) => {
              if (res.data.applyStatus == 2) {
                this.alilanhaival = 2;
              } else if (res.data.applyStatus == 4) {
                this.alilanhaival = 4;
                this.applyMsg = res.data.applyMsg;
              }
            });
          }
          // if(res.data.blueseaStatus == 2){
          //    this.alilanhai = true;
          // }else{
          //   this.alilanhai = false;
          // }
          if (res.data.greenStatus == 2) {
            this.wecharlvzhou = true;
          } else {
            this.wecharlvzhou = false;
          }
          if (channle == "wx") {
            this.ratearr.ratenum = this.splice(res.data.wxChannelRate);
          } else if (channle == "ali") {
            this.ratearr.ratenum = this.splice(res.data.aliChannelRate);
          } else if (channle == "uni") {
            this.ratearr.ratenum = this.splice(res.data.uniChannelRate);
          } else if (channle == "bestpay") {
            this.ratearr.ratenum = this.splice(res.data.bestpayChannelRate);
          }
          this.channel();
        } else if (res.code == 500) {
          this.$message.error(res.message);
        }
      });
    },
    beforeUploadImgF449(){
      return new Promise((resolve, reject) => {
               this.uploadUrl = process.env.VUE_APP_BASE_URL + `/product/v31/api/merchant/upload/F449/16/4`
                setTimeout(() => {
                    resolve() 
                }, 100)
          })
    },
    beforeUploadImgF447(){
      return new Promise((resolve, reject) => {
               this.uploadUrl = process.env.VUE_APP_BASE_URL + `/product/v31/api/merchant/upload/F447/16/4`
                setTimeout(() => {
                    resolve() 
                }, 100)
          })
    },
    doorUpLoadSuccessF447(file){
      if(file.code == 200){
           this.balancePayForm.F447Url = file.data.file_url
           this.balancePayForm.F447Id = file.data.file_id
        }else{
          this.$message.error(file.message)
        }
        this.$forceUpdate()
    },
    doorUpLoadSuccess(file){
      if(file.code == 200){
           this.balancePayForm.F449Url = file.data.file_url
           this.balancePayForm.F449Id = file.data.file_id
        }else{
          this.$message.error(file.message)
        }
        this.$forceUpdate()
    },
    // 通道列表
    async channel() {
      let res = await channel({ merchantid: this.merchantno });
      if (res.code == 405) {
        sessionStorage.removeItem("token");
        this.$router.push("/login");
      } else {
        this.channelinfo = res.data.rows;
        this.channleitem();
        this.addCPlatformBtnShowFun(this.channelinfo);
      }
    },
    addCPlatformBtnShowFun(arr) {
      if (this.userinfo.rolesId == 1 || this.userinfo.rolesId == 8) {
        for (let i = 0; i < arr.length; i++) {
          if (arr[i].channelType == 2) {
            this.addCPlatformBtnShow = true;
          } else {
            this.addCPlatformBtnShow = false;
          }
        }
      }
    },
    splice(val) {
      if (!!val) {
        var result = val.split(",", 1);
        return result[0] / 10;
      }
    },
    // 获取支付配置
    async channelget(channelid) {
      const res = await channelget({}, channelid);
      if (res.code === 200) {
        // console.log("支付配置" + res);
        return res.data;
      }
      if (res.code == 405) {
        sessionStorage.removeItem("token");
        this.$router.push("/login");
      }
      //             channelget(channelid) {
      //                 channelget({}, channelid).then(res => {
      //                     if (res.code == 405) {
      //                         sessionStorage.removeItem("token");
      //                         this.$router.push("/login");
      //                     } else {
      //                         this.paydeploy = res.data;
      //                         console.log(this.paydeploy)
      //                     }
      //                 });
    },
    //微信支付配置
    async wecharpayset(val) {
      if (val == 1) {
        this.paydeploys = 1;
        const obj = await this.channelget(this.merchantinfo.wxChannelId);
        this.paydeploy = obj;
      } else if (val == 2) {
        this.paydeploys = 2;
        const obj = await this.channelget(this.merchantinfo.aliChannelId);
        this.paydeploy = obj;
      }
      this.visible = true;
      this.mchiddis = true;
    },
    // 修改支付配置
    updatewx() {
      updatewx(
        {
          mchId: this.paydeploy.mchId,
          wxMchId: this.paydeploy.wxMchId,
          wxMode: this.paydeploy.wxMode,
          miniAppid: this.paydeploy.miniAppid,
          wxAppid: this.paydeploy.wxAppid,
          wxAppsecret: this.paydeploy.wxAppsecret,
          aliToken: this.paydeploy.aliToken,
          aliAppid: this.paydeploy.aliAppid,
          aliPid: this.paydeploy.aliPid,
          aliOuterid: this.paydeploy.aliOuterid,
          mchKey: this.paydeploy.mchKey,
          appAppid: this.paydeploy.appAppid,
          servAppid: this.paydeploy.servAppid,
          // servInstno: this.paydeploy.servInstno,
          servKey: this.paydeploy.servKey,
        },
        // this.paydeploy,
        this.merchantinfo.wxChannelId
      ).then((res) => {
        // console.log(res + "修改额度包内容");
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.$message({
            message: "修改成功",
            type: "success",
          });
          this.visible = false;
        } else {
          this.$message.error(res.message);
        }
      });
      // channeldetailupdate(
      //   this.paydeploy,
      //   // {
      //   //     mchId: this.paydeploy.mchId,
      //   //     wxMchId: this.paydeploy.wxMchId,
      //   //     wxMode: this.paydeploy.wxMode,
      //   //     miniAppid: this.paydeploy.miniAppid,
      //   //     wxAppid: this.paydeploy.wxAppid,
      //   //     wxAppsecret: this.paydeploy.wxAppsecret,
      //   //     aliToken: this.paydeploy.aliToken,
      //   //     aliAppid: this.paydeploy.aliAppid,
      //   //     aliPid: this.paydeploy.aliPid,
      //   //     aliOuterid: this.paydeploy.aliOuterid,
      //   //     mchKey: this.paydeploy.mchKey,
      //   //     appAppid: this.paydeploy.appAppid,
      //   //     servAppid: this.paydeploy.servAppid,
      //   //     servInstno: this.paydeploy.servInstno,
      //   //     servKey:this.paydeploy.servKey
      //   // },
      //   this.merchantinfo.wxChannelId
      // ).then((res) => {
      //   if (res.code == 405) {
      //     sessionStorage.removeItem("token");
      //     this.$router.push("/login");
      //   } else if (res.code == 200) {
      //     this.$message({
      //       message: "修改成功",
      //       type: "success",
      //     });
      //     this.visible = false;
      //   } else {
      //     this.$message.error(res.message);
      //   }
      // });
    },
    // 修改支付宝支付配置
    updateali() {
      updatewx(
        {
          mchId: this.paydeploy.mchId,
          aliToken: this.paydeploy.aliToken,
          aliAppid: this.paydeploy.aliAppid,
          aliPid: this.paydeploy.aliPid,
          aliOuterid: this.paydeploy.aliOuterid,
          mchKey: this.paydeploy.mchKey,
          servAppid: this.paydeploy.servAppid,
          // servInstno: this.paydeploy.servInstno,
          // aliUserId: this.paydeploy.aliUserId,
          //   quota:this.paydeploy.quota
          servKey: this.paydeploy.servKey,
          aliUserId: this.paydeploy.aliUserId,
          appAppid: this.paydeploy.appAppid,
        },
        this.merchantinfo.aliChannelId
      ).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.$message({
            message: "修改成功",
            type: "success",
          });
          this.visible = false;
        } else {
          this.$message.error(res.message);
        }
      });
    },

    // 费率列表
    ratelist(channle) {
      let userinfo = JSON.parse(sessionStorage.getItem("userInfo"));
      ratelist(
        {
          roleId: userinfo.rolesId,
          fid: userinfo.fid,
          // channelType: channle,
          bdId: this.merchantinfo.bdId,
        },
        this.merchantinfo.wxChannelId
      ).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else {
          this.ratelists = res.data;
        }
      });
    },
    // 打开费率box
    rateBtn(type) {
      let channle;
      if (type == "wx") {
        this.ratetype = 1;
        channle = this.merchantinfo.wxChannelType;
        this.ChannelName = this.merchantinfo.wxChannelName;
      } else if (type == "ali") {
        this.ratetype = 2;
        channle = this.merchantinfo.aliChannelType;
        this.ChannelName = this.merchantinfo.aliChannelName;
      } else if (type == "uni") {
        this.ratetype = 3;
        channle = this.merchantinfo.uniChannelType;
        this.ChannelName = this.merchantinfo.uniChannelName;
      } else if (type == "bestpay") {
        this.ratetype = 4;
        channle = this.merchantinfo.bestpayChannelType;
        this.ChannelName = this.merchantinfo.bestpayChannelName;
      } else if (type == "ecny") {
        this.ratetype = 5;
        channle = this.merchantinfo.ecnyChannelType;
        this.ChannelName = this.merchantinfo.ecnyChannelName;
      } else if (type == "longpay") {
        this.ratetype = 6;
        channle = this.merchantinfo.longpayChannelType;
        this.ChannelName = this.merchantinfo.longpayChannelName;
      }
      this.rate = true;
      this.ratelist(channle);
      this.merchantdetails(type);
    },
    //changer费率
    rateevent(val) {
      let obj = {};
      obj = this.ratelists.find((item) => {
        //这里的userList就是上面遍历的数据源
        return item.rate === val; //筛选出匹配数据
      });
      this.ratearr.wxratenum = obj.rateCode;
    },
    //添加changer费率
    channelrates(val) {
      let obj = {};
      obj = this.ratelists.find((item) => {
        //这里的userList就是上面遍历的数据源
        return item.rate === val; //筛选出匹配数据
      });
      this.channelrate = obj.rate;
    },
    // 修改费率
    rateok(type) {
      if(!this.ratearr.wxratenum){
         const data = this.ratelists.find(item=>item.rate == this.ratearr.ratenum * 10)
         if(data){
          this.ratearr.wxratenum = data.rateCode
         }
      }
      if (this.ratearr.wxratenum ) {
        if (this.ratetype == 1) {
          updaterate(
            {
              rateCode: this.ratearr.wxratenum,
            },
            this.merchantinfo.id
          ).then((res) => {
            if (res.code == 405) {
              sessionStorage.removeItem("token");
              this.$router.push("/login");
            } else if (res.code == 200) {
              this.$message({
                message: "修改成功",
                type: "success",
              });
              this.merchantdetails();
              this.rate = false;
            } else {
              this.$message.error(res.message);
            }
          });
        } else if (this.ratetype == 2) {
          aliupdaterate(
            {
              rateCode: this.ratearr.wxratenum,
            },
            this.merchantinfo.id
          ).then((res) => {
            if (res.code == 405) {
              sessionStorage.removeItem("token");
              this.$router.push("/login");
            } else if (res.code == 200) {
              this.$message({
                message: "修改成功",
                type: "success",
              });
              this.merchantdetails();
              this.rate = false;
            } else {
              this.$message.error(res.message);
            }
          });
        } else if (this.ratetype == 3) {
          uniupdaterate(
            {
              rateCode: this.ratearr.wxratenum,
            },
            this.merchantinfo.id
          ).then((res) => {
            if (res.code == 405) {
              sessionStorage.removeItem("token");
              this.$router.push("/login");
            } else if (res.code == 200) {
              this.$message({
                message: "修改成功",
                type: "success",
              });
              this.merchantdetails();
              this.rate = false;
            } else {
              this.$message.error(res.message);
            }
          });
        } else if (this.ratetype == 4) {
          bestpayupdaterate(
            {
              rateCode: this.ratearr.wxratenum,
            },
            this.merchantinfo.id
          ).then((res) => {
            if (res.code == 405) {
              sessionStorage.removeItem("token");
              this.$router.push("/login");
            } else if (res.code == 200) {
              this.$message.success("修改成功");
              this.merchantdetails();
              this.rate = false;
            } else {
              this.$message.eror(res.message);
            }
          });
        } else if (this.ratetype == 5) {
          ecnyupdaterate(
            {
              rateCode: this.ratearr.wxratenum,
            },
            this.merchantinfo.id
          ).then((res) => {
            if (res.code == 405) {
              sessionStorage.removeItem("token");
              this.$router.push("/login");
            } else if (res.code == 200) {
              this.$message.success("修改成功");
              this.merchantdetails();
              this.rate = false;
            } else {
              this.$message.eror(res.message);
            }
          });
        } else if (this.ratetype == 6) {
          longpayupdaterate(
            {
              rateCode: this.ratearr.wxratenum,
            },
            this.merchantinfo.id
          ).then((res) => {
            if (res.code == 405) {
              sessionStorage.removeItem("token");
              this.$router.push("/login");
            } else if (res.code == 200) {
              this.$message.success("修改成功");
              this.merchantdetails();
              this.rate = false;
            } else {
              this.$message.eror(res.message);
            }
          });
        }
      } else {
        this.$message.error("请修改费率");
      }
    },
    // 选择通道
    changechanne(val) {
      this.ratenum = val;
    },
    // 切换通道列表
    changechannelBox(val) {
      this.changechannel = true;
      this.merchantdetails();
      channelselect({
        merchantid: this.merchantinfo.id,
      }).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else {
          this.channellist = res.data;
          if (val == 1) {
            this.channeltypes = 1;
            this.channelarr.ratenum = this.merchantinfo.wxChannelId;
            this.change_channel_value = this.merchantinfo.wxChannelId;
            this.ratenum = this.merchantinfo.wxChannelId;
            this.rateswitch = false;
          } else if (val == 2) {
            this.channeltypes = 2;
            this.channelarr.ratenum = this.merchantinfo.aliChannelId;
            this.change_channel_value = this.merchantinfo.aliChannelId;
            this.ratenum = this.merchantinfo.aliChannelId;
            this.rateswitch = false;
          } else if (val == 3) {
            this.channeltypes = 3;
            this.channelarr.ratenum = this.merchantinfo.uniChannelName;
            this.change_channel_value = this.merchantinfo.uniChannelName;
            this.ratenum = this.merchantinfo.uniChannelId;
            this.rateswitch = false;
          } else if (val == 4) {
            this.channelTypes = 4;
            this.channelarr.ratenum = this.merchantinfo.bestpayChannelName;
            this.change_channel_value = this.merchantinfo.bestpayChannelName;
            this.ratenum = this.merchantinfo.bestpayChannelId;
            this.rateswitch = false;
          } else if (val == 5) {
            this.channelTypes = 5;
            this.channelarr.ratenum = this.merchantinfo.ecnyChannelName;
            this.change_channel_value = this.merchantinfo.ecnyChannelName;
            this.ratenum = this.merchantinfo.ecnyChannelId;
            this.rateswitch = false;
          } else if (val == 6) {
            this.channelTypes = 6;
            this.channelarr.ratenum = this.merchantinfo.longpayChannelName;
            this.change_channel_value = this.merchantinfo.longpayChannelName;
            this.ratenum = this.merchantinfo.longpayChannelId;
            this.rateswitch = false;
          }
        }
      });
    },
    // 确定切换通道
    channelok() {
      // console.log(this.channeltypes);
      this.$confirm("确定切换通道吗？", "系统提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          if (this.channeltypes == 1) {
            updatechannel(
              {
                wxChannelId: this.ratenum,
              },
              this.merchantno
            ).then((res) => {
              if (res.code == 405) {
                sessionStorage.removeItem("token");
                this.$router.push("/login");
              } else if (res.code == 200) {
                this.$message({
                  message: "切换通道成功",
                  type: "success",
                });
                this.merchantdetails();
                this.changechannel = false;
              } else {
                this.$message.error(res.message);
              }
            });
          } else if (this.channeltypes == 2) {
            updatechannel(
              {
                aliChannelId: this.ratenum,
              },
              this.merchantno
            ).then((res) => {
              if (res.code == 405) {
                sessionStorage.removeItem("token");
                this.$router.push("/login");
              } else if (res.code == 200) {
                this.$message({
                  message: "切换通道成功",
                  type: "success",
                });
                this.merchantdetails();
                this.changechannel = false;
              } else {
                this.$message.error(res.message);
              }
            });
          } else if (this.channeltypes == 3) {
            updatechannel(
              {
                uniChannelId: this.ratenum,
              },
              this.merchantno
            ).then((res) => {
              if (res.code == 405) {
                sessionStorage.removeItem("token");
                this.$router.push("/login");
              } else if (res.code == 200) {
                this.$message({
                  message: "切换通道成功",
                  type: "success",
                });
                this.merchantdetails();
                this.changechannel = false;
              } else {
                this.$message.error(res.message);
              }
            });
          } else if (this.channelTypes == 4) {
            updatechannel(
              {
                bestpayChannelId: this.ratenum,
              },
              this.merchantno
            ).then((res) => {
              if (res.code == 405) {
                sessionStorage.removeItem("token");
                this.$router.push("/login");
              } else if (res.code == 200) {
                this.$message({
                  message: "切换通道成功",
                  type: "success",
                });
                this.merchantdetails();
                this.changechannel = false;
              } else {
                this.$message.error(res.message);
              }
            });
          } else if (this.channelTypes == 5) {
            updatechannel(
              {
                ecnyChannelId: this.ratenum,
              },
              this.merchantno
            ).then((res) => {
              if (res.code == 405) {
                sessionStorage.removeItem("token");
                this.$router.push("/login");
              } else if (res.code == 200) {
                this.$message({
                  message: "切换通道成功",
                  type: "success",
                });
                this.merchantdetails();
                this.changechannel = false;
              } else {
                this.$message.error(res.message);
              }
            });
          } else if (this.channelTypes == 6) {
            updatechannel(
              {
                longpayChannelId: this.ratenum,
              },
              this.merchantno
            ).then((res) => {
              if (res.code == 405) {
                sessionStorage.removeItem("token");
                this.$router.push("/login");
              } else if (res.code == 200) {
                this.$message({
                  message: "切换通道成功",
                  type: "success",
                });
                this.merchantdetails();
                this.changechannel = false;
              } else {
                this.$message.error(res.message);
              }
            });
          }
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
    // 打开通道结算周期
    SettlementBtn(val) {
      if (val == 1) {
        this.settlementtype = 1;
        //获取通道结算周期列表
        getSettlement({}, this.merchantinfo.wxChannelId).then((res) => {
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            let Settlement = res.data.split(",");
            this.Settlement = Settlement;
          }
        });
      } else if (val == 2) {
        this.settlementtype = 2;
        //获取通道结算周期列表
        getSettlement({}, this.merchantinfo.aliChannelId).then((res) => {
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            let Settlement = res.data.split(",");
            this.Settlement = Settlement;
          }
        });
      }
      this.checkout = true;
      // this.getSettlement();
    },
    // 微信关注配置Box
    applistBtn() {
      this.attention = true;
      this.applist();
      this.paydeploy.url = "";
      this.addappid.attentionid = "";
      this.addappid.payappid = "";
      this.appidLists = [];
      this.jspathLists = [];
    },
    // 微信小程序配置
    wxminiprogrambtn() {
      this.wxminiprogram = true;
      this.applist(2);
      this.paydeploy.url = "";
      this.addappid.attentionid = "";
      this.addappid.payappid = "";
      this.appidLists = [];
      this.jspathLists = [];
    },
    // 获取微信关注配置
    applist(type) {
      let that = this;
      let appids = [];
      let appurls = [];
      applist({
        merchantid: this.merchantinfo.id,
        configType: type,
      }).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else {
          this.wxlists = res.data;
        }
      });
    },
    // 结算周期修改按钮
    updatesettlement() {
      if (this.settlementtype == 1) {
        updatesettlement(
          {
            wxSettlement: this.channelarr.wxSettlement,
          },
          this.merchantinfo.wxChannelId
        ).then((res) => {
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            this.$message({
              message: "修改成功",
              type: "success",
            });
            this.checkout = false;
            this.merchantdetails();
          } else {
            this.$message.error(res.message);
          }
        });
      } else if (this.settlementtype == 2) {
        updatesettlement(
          {
            aliSettlement: this.channelarr.aliSettlement,
          },
          this.merchantinfo.aliChannelId
        ).then((res) => {
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            this.$message({
              message: "修改成功",
              type: "success",
            });
            this.checkout = false;
            this.merchantdetails();
          } else {
            this.$message.error(res.message);
          }
        });
      }
    },
    // 修改微信关注配置
    appsave(num) {
      const loading = this.$loading({
        lock: true,
        text: "Loading",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      var that = this;
      axios
        .post(
          process.env.VUE_APP_BASE_URL + "/product/v31/api/merchant/app/save",
          {
            MerchantAppidApp: this.appidLists,
            MerchantAppidPath: this.jspathLists,
            merchantid: this.merchantno,
            wxChannelId: this.channelarr.wxChannelId,
            merchantno: this.channelinfo[0].mchId,
            configType: num,
          },
          {
            headers: {
              "Content-Type": "application/json",
              token: sessionStorage.getItem("token"),
            },
          }
        )
        .then(function (res) {
          loading.close();
          if (res.data.code == 405) {
            sessionStorage.removeItem("token");
            that.$router.push("/login");
          } else if (res.data.code == 200) {
            that.$message({
              message: "修改成功",
              type: "success",
            });
            if (num == 2) {
              that.wxminiprogram = false;
              that.applist(2);
            } else {
              that.attention = false;
              that.applist();
            }
            this.paydeploy.url = "";
            this.addappid.attentionid = "";
            this.addappid.payappid = "";
            loading.close();
          } else {
            that.$message.error(res.data.message);
            if (num == 2) {
              that.applist(2);
              that.wxminiprogram = false;
            } else {
              that.applist();
              that.attention = false;
            }
            loading.close();
          }
        })
        .catch(function (error) {
          // that.$message.error(res.data.message);
          loading.close();
          that.attention = false;
        });
    },
    // 删除微信关注配置
    appremove(id) {
      appremove({}, id).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else {
          if (res.code == 200) {
            this.$message({
              message: "删除成功",
              type: "success",
            });
            this.applist();
          } else {
            this.$message.error(res.message);
          }
        }
      });
    },
    // 打开支付宝授权配置
    aliBoxs() {
      $("#qrcode").html("");
      this.aliBox = true;
      alipayauth({}, this.merchantinfo.id).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else {
          this.alipayautharr = res.data;

          QRCode.toDataURL(res.data.url)
            .then((url) => {
              var qrbox = document.querySelector("#qrcode");
              const img = new Image();
              img.src = url;
              qrbox.appendChild(img);
            })
            .catch((err) => {
              console.error(err);
            });
        }
      });
      // setTimeout(function(){

      //  }, 100);
    },
    // 配置银联商户号
    addbank() {
      addbank(
        {
          merchantNoUni: this.bank.mchId,
        },
        this.merchantinfo.id
      ).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.$message({
            message: "修改成功",
            type: "success",
          });
          this.banks = false;
          this.bank.mchId = "";
          this.merchantdetails();
        } else {
          this.$message.error(res.message);
        }
      });
    },
    // 修改银行卡费率
    updateBankRate() {
      updateBankRate(
        {
          creditcardProfitRate: (this.costs.creditcardProfitRate * 10).toFixed(
            2
          ),
          debitcardProfitRate: (this.costs.debitcardProfitRate * 10).toFixed(2),
          debitcardTopFee: this.costs.debitcardTopFee * 100,
        },
        this.merchantinfo.id
      ).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.$message({
            message: "修改成功",
            type: "success",
          });
          this.cost = false;
          this.merchantdetails();
        } else {
          this.$message.error(res.message);
        }
      });
    },
    // 停用通道
    deletechannel(id) {
      this.$confirm("是否确定停用？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          deletechannel({}, id).then((res) => {
            if (res.code == 405) {
              sessionStorage.removeItem("token");
              this.$router.push("/login");
            } else if (res.code == 200) {
              this.$message({
                message: "已停用",
                type: "success",
              });
              this.channel();
            } else {
              this.$message.error(res.message);
            }
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
    // 获取可选通道
    channelselects(splitType) {
      if(splitType){
        divideChannelList({splitType}).then(res=>{
          this.channellists = res.data.rows
          console.log(this.merchantinfo.splitChannelId)
          if(this.merchantinfo.splitChannelId){
            const index =   this.channellists.findIndex(item=> item.id == this.merchantinfo.splitChannelId)
            this.channellists.splice(index,1)
          }
        })
      }else{
        channelselects({}, this.merchantinfo.id,splitType).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else {
          this.channellists = res.data;
        
        }
      });
      }
      
    },
    // 添加通道Box
    addchannelBtn() {
      this.channelselects();
      this.ratelist();
      this.channelarr = {};
      this.addchannel = true;
    },
    // 添加分账通道
    switchChannelBtn(){
      this.switchchannel = true
      this.ratelist();
      this.channelselects(1)
      this.channelarr = {}
    },
    switchChannelok(){
       this.splitopen(this.channelarr.channelid)
    },
    // 确定添加通道
    addchannelok() {
      const loading = this.$loading({
        lock: true,
        text: "Loading",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      let switchs = false;
      if (switchs) {
        return;
      }
      addchannels({
        merchantid: this.merchantinfo.id,
        //channelType: this.channelarr.channelid,
        channelId: this.channelarr.channelid,
        channelName: this.channelarr.channelName,
        rate: this.channelrate,
      }).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.$message({
            message: "已添加",
            type: "success",
          });
          switchs = false;
          this.addchannel = false;
          this.channelrate = "";
          loading.close();
          this.channel();
        } else {
          this.$message.error(res.message);
          loading.close();
        }
      });
    },
    // chang通道
    watchchannel(val) {
      let obj = {};
      obj = this.channellists.find((item) => {
        //这里的userList就是上面遍历的数据源
        return item.code === val; //筛选出匹配数据
      });
      this.channelarr.channelName = obj.channelname;
    },
    // 开通智慧零售
    registerQiMai() {
      const loading = this.$loading({
        lock: true,
        text: "Loading",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      registerQiMai({}, this.merchantinfo.id).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          loading.close();
          this.$message({
            message: "已开通",
            type: "success",
          });
          this.merchantdetails();
        } else {
          loading.close();
          this.$message.error(res.message);
        }
      });
    },
    // 复制
    copymerchants() {
      this.$router.push({ path: "/copymerchants" });
      sessionStorage.setItem("auditinfo", JSON.stringify(this.merchantinfo));
      sessionStorage.removeItem("channel");
    },
    // 修改
    altermerchants() {
      // const channelTypeList = ['16','17','18']
      // const data =  channelTypeList.find(item => item == this.merchantinfo.aliChannelType)
      // if(data){
      //   this.$router.push({ path: `/remittanceEntry?mid=${this.merchantinfo.id}&channelId=${data}` })
      // }else{
        this.$router.push({ path: "/altermerchants" })
        sessionStorage.setItem("auditinfo", JSON.stringify(this.merchantinfo));
        sessionStorage.removeItem("channel");
      // }
      
    },
    //  跳转到修改
    revamp(val) {
      this.$router.push({ path: "/altermerchants" });
      sessionStorage.setItem("auditinfo", JSON.stringify(this.merchantinfo));
      sessionStorage.setItem("channel", JSON.stringify(val));
    },
    // 申请微信小微进件
    wxaddmch(id, channelId) {
      const loading = this.$loading({
        lock: true,
        text: "Loading",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      wechatRegistry(
        {
          channelId: channelId,
        },
        id
      ).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.$message({
            message: "申请成功",
            type: "success",
          });
          loading.close();
          this.channel();
        } else {
          this.$message.error(res.message);
          loading.close();
        }
      });
    },
    //随行付电子协议
    elecContractSign(id) {
      this.$confirm("确定签署电子协议？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          const loading = this.$loading({
            lock: true,
            text: "Loading",
            spinner: "el-icon-loading",
            background: "rgba(0, 0, 0, 0.7)",
          });
          elecContractSign({}, id).then((res) => {
            if (res.code == 405) {
              sessionStorage.removeItem("token");
              this.$router.push("/login");
            } else if (res.code == 200) {
              this.$message({
                message: "签署成功",
                type: "success",
              });
              loading.close();
              this.channel();
            } else {
              this.$message.error(res.message);
              loading.close();
            }
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
    // 驳回原因
    reject(val) {
      this.$alert(val, "驳回原因", {
        confirmButtonText: "确定",
      });
    },
    // 工单号
    Order(id) {
      this.$alert(id, "工单号", {
        confirmButtonText: "确定",
      });
    },
    // 签约小微
    // signing(src){
    //   this.signingBox = true;
    //   $('.signingcode').html('')

    //   setTimeout(function(){
    //       QRCode.toDataURL(src)
    //         .then(url => {
    //         let qrboxs = document.querySelector(".signingcode");
    //         const img = new Image();
    //         img.src=url;
    //         qrboxs.appendChild(img);
    //         })
    //         .catch(err => {
    //           console.error(err)
    //         })
    //   },100)
    // }

    // 可以修改渠道号按钮
    mchiddisBtn() {
      this.$confirm("是否确定修改渠道商户号?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.mchiddis = false;
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
    //显示添加标签弹框
    popuptag() {
      if (this.Channeldeploy1 === false) {
        this.usedTags = [];
      }
      this.Channeldeploy1 = true;
      //获取指定对象可添加标签
      getSelectTagsByRole({
        fid: this.merchantno,
        roleId: 5,
      }).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          if (this.unUsedTags.length == 0) {
            for (var i = 0; i < res.data.allTags.length; i++) {
              this.unUsedTags.push({
                key: res.data.allTags[i].id,
                label: res.data.allTags[i].name,
              });
            }
          }
          if (this.usedTags.length == 0) {
            for (var i = 0; i < res.data.usedTags.length; i++) {
              this.usedTags.push(res.data.usedTags[i].id);
            }
          }
        } else if (res.code == 500) {
          this.$message.error(res.message);
        }
      });
    },
    //获取指定对象已拥有的标签
    getdimensionTagList() {
      this.adm_tag = [];
      this.cw_tag = [];
      this.fws_tag = [];
      getdimensionTagList({
        fid: this.merchantno,
        roleId: 5,
      }).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          for (var i = 0; i < res.data.length; i++) {
            if (
              res.data[i].tagCreatorRole == 1 ||
              res.data[i].tagCreatorRole == 8
            ) {
              this.adm_tag.push({
                key: res.data[i].id,
                label: res.data[i].tagName,
              });
            } else if (res.data[i].tagCreatorRole == 9) {
              this.cw_tag.push({
                key: res.data[i].id,
                label: res.data[i].tagName,
              });
            } else if (res.data[i].tagCreatorRole == 2) {
              this.fws_tag.push({
                key: res.data[i].id,
                label: res.data[i].tagName,
              });
            }
          }
          // if(this.rolesId == 2){
          //   this.adm_tag = []
          //   this.cw_tag = []
          // }
        } else if (res.code == 500) {
          this.$message.error(res.message);
        }
      });
    },
    //给指定对象添加标签
    addLabel() {
      var data = this.usedTags.join(",");
      postDimensionTagSave(
        {
          ids: data,
          fid: this.merchantno,
          roleId: 5,
          holder: this.merchantName,
        },
        this.merchantno
      ).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.$message({
            message: "添加成功",
            type: "success",
          });
          this.Channeldeploy1 = false;
          this.getdimensionTagList();
        } else if (res.code == 500) {
          this.Channeldeploy1 = true;
          this.$message.error(res.message);
        }
      });
    },
    handleClose(id) {
      this.$confirm(`是否确定删除该标签？`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          postDimensionTagRemove({}, id).then((res) => {
            if (res.code == 405) {
              sessionStorage.removeItem("token");
              this.$router.push("/login");
            } else if (res.code == 200) {
              this.$message({
                message: "删除成功",
                type: "success",
              });
              this.getdimensionTagList();
            } else if (res.code == 500) {
              this.$message.error(res.message);
            }
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
    // 蓝海
    lanhai(id) {
      const loading = this.$loading({
        lock: true,
        text: "Loading",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      if (this.alilanhai == true) {
        setBlueStatus(
          {
            status: "2",
          },
          id
        ).then((res) => {
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            this.$message({
              message: "开通成功",
              type: "success",
            });
            loading.close();
            this.merchantdetails();
          } else {
            this.$message.error(res.message);
            loading.close();
          }
        });
      } else if (this.alilanhai == false) {
        setBlueStatus(
          {
            status: "0",
          },
          id
        ).then((res) => {
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            this.$message({
              message: "已暂停",
              type: "success",
            });
            loading.close();
            this.merchantdetails();
          } else {
            this.$message.error(res.message);
            loading.close();
          }
        });
      }
    },
    // 绿洲
    lvzhou(id) {
      const loading = this.$loading({
        lock: true,
        text: "Loading",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      if (this.wecharlvzhou == true) {
        setGreenStatus(
          {
            status: "2",
          },
          id
        ).then((res) => {
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            this.$message({
              message: "开通成功",
              type: "success",
            });
            loading.close();
            this.merchantdetails();
          } else {
            this.$message.error(res.message);
            loading.close();
          }
        });
      } else if (this.wecharlvzhou == false) {
        setGreenStatus(
          {
            status: "0",
          },
          id
        ).then((res) => {
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            this.$message({
              message: "已暂停",
              type: "success",
            });
            loading.close();
            this.merchantdetails();
          } else {
            this.$message.error(res.message);
            loading.close();
          }
        });
      }
    },
    // 通道信息
    channleitem() {
      let _this = this;
      if (this.channelarr.wxChannelId) {
        let wxChannelId = this.channelinfo.filter(function (item) {
          return item.id == _this.channelarr.wxChannelId;
        });
        this.wxchannelboxinfo = {
          wxchannelName: wxChannelId[0].channelName,
          wxmchId: wxChannelId[0].mchId,
          wxziMchId: wxChannelId[0].wxMchId,
        };
      }
      if (this.channelarr.aliChannelId) {
        let aliChannelId = this.channelinfo.filter(function (item) {
          return item.id == _this.channelarr.aliChannelId;
        });
        this.alichannelboxinfo = {
          alichannelName: aliChannelId[0].channelName,
          alimchId: aliChannelId[0].mchId,
          aliziMchId: aliChannelId[0].aliSmid,
        };
      }
    },
    // 电子发票
    invoice() {
      this.bill = true;
    },
    // 获取总店
    allmerchantlist() {
      allmerchantlist({
        pid: "-1",
      }).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.merarr = [];
          for (var i = 0; i < res.data.rows.length; i++) {
            this.merarr.push({
              value: res.data.rows[i].merchantName,
              id: res.data.rows[i].id,
            });
          }
        } else {
          this.$message.error(res.message);
        }
      });
    },
    // 总分店
    querySearch3(queryString, cb) {
      let merarr = this.merarr;
      let results = queryString
        ? merarr.filter(this.createFilter(queryString))
        : merarr;
      // 调用 callback 返回建议列表的数据
      cb(results);
    },
    // 选取总店
    dianming(val) {
      this.setupshops.pid = val.id;
    },
    // 打开总分店
    zonefendianbtn(id) {
      let that = this;
      this.allmerchantlist();
      chaindetail({
        id: id,
      }).then((res) => {
        if (res.code == 200) {
          let data = res.data;
          if (data.pid == "-1") {
            this.setupshops.type = "-1";
          } else {
            this.setupshops.type = "2";
            this.setupshops.pid = data.pid;
            this.setupshops.openTime = data.openTime;
            this.setupshops.closeTime = data.closeTime;
            this.setupshops.lines = data.limitFee;
            this.setupshops.dianming = data.pName;
            if (data.limitFee == 0) {
              this.setupshops.permissions = "2";
            } else {
              this.setupshops.permissions = "1";
            }
          }
        } else {
          that.$message.error(res.message);
        }
      });
      this.zongfendian = true;
    },
    // 编辑总分店
    setupshopok() {
      let that = this;
      chainupdate({
        id: that.merchantinfo.id,
        openTime: that.setupshops.openTime,
        closeTime: that.setupshops.closeTime,
        limitFee: that.setupshops.lines,
        pid: that.setupshops.pid,
        polling: that.setupshops.polling,
      }).then((res) => {
        if (res.code == 200) {
          that.$message({
            message: "开通成功",
            type: "success",
          });
        } else {
          that.$message.error(res.message);
        }
        this.zongfendian = false;
        this.merchantdetails();
        this.setupshops = {
          type: "-1",
          openTime: "",
          closeTime: "",
          permissions: "",
          lines: "",
          pid: "-1",
          polling: "0",
          dianming: "",
        };
      });
    },
    // 关闭总门店
    chainclose(id) {
      let that = this;
      this.$confirm("是否确定关闭？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          chainclose({
            id: id,
          }).then((res) => {
            if (res.code == 200) {
              that.$message({
                message: "已关闭总分店模式",
                type: "success",
              });
              this.$router.push({
                path: "/mymerchants",
              });
              setTimeout(function () {
                that.$router.go(0);
              }, 200);
            } else {
              that.$message.error(res.message);
            }
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
    // 打开分账
    openfenzhang(item) {
      console.log(111);
      this.accountLoading = true;
      this.fenzhang = true;
      // this.chainsubs(item.channelType)
      this.channelType = item.channelType;
      // 获取商户通道分账配置
      splitinfo({
        merchantId: this.merchantinfo.id,
        channelType: item.channelType,
      }).then((res) => {
        if (res.data.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.data.code == 200) {
          if (res.data.data.splitList) {
            this.accountLoading = false;
            this.fenzhangData = res.data.data.splitList;
          }
        } else {
          this.accountLoading = false;
          this.$message.error(res.data.message);
        }
        this.accountLoading = false;
      });
    },
    // 查询分账分店
    querySearch(queryString, cb) {
      let servicearr = this.servicearr;
      let results = queryString
        ? servicearr.filter(this.createFilter(queryString))
        : servicearr;
      // 调用 callback 返回建议列表的数据
      cb(results);
    },
    // 获取分店
    chainsubs(channelType) {
      chainsubs({
        id: this.merchantinfo.id,
        channelType: channelType,
        merchantName: "",
      }).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.servicearr = [];
          for (var i = 0; i < res.data.length; i++) {
            this.servicearr.push({
              value: res.data[i].merchantName,
              id: res.data[i].merchantId,
            });
          }
        } else {
          this.$message.error(res.message);
        }
      });
    },
    serviceid(item) {
      this.mchId = item.id;
    },
    createFilter(queryString) {
      return (restaurant) => {
        return (
          restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) !==
          -1
        );
      };
    },
    addfenzhang() {
      if (this.fenzhangs.name && this.fenzhangs.splitRate) {
        let farr = {
          merchantNo: this.fenzhangs.name,
          splitRate: this.fenzhangs.splitRate,
        };
        this.fenzhangData.push(farr);
        this.fenzhangs = {};
      } else {
        this.$message.error("请确定分店商户和分店比例");
      }
    },
    // 确定分账配置
    async splitconfigt() {
      let that = this;
      // let obj = {
      //     merchantId: this.merchantinfo.id,
      //     channelType: this.channelType,
      //     splitList: this.fenzhangData,
      // }
      // const res = await confirmSplitConfig({
      //     merchantId: this.merchantinfo.id,
      //     channelType: this.channelType,
      //     splitList: this.fenzhangData,
      // })
      // if(res.code === 405) {
      //     sessionStorage.removeItem("token");
      //     this.$router.push("/login");
      // } else {
      //     if(res.code === 200) {
      //         this.$message.success('添加成功')
      //         this.fenzhang = false
      //     } else {
      //         this.$message.error(res.message)
      //     }
      // }

      axios
        .post(
          this.url,
          {
            merchantId: this.merchantinfo.id,
            channelType: this.channelType,
            splitList: this.fenzhangData,
          },
          {
            headers: {
              "Content-Type": "application/json",
              token: sessionStorage.getItem("token"),
            },
          }
        )
        .then(function (res) {
          if (res.data.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.data.code == 200) {
            that.$message({
              message: "添加成功",
              type: "success",
            });
            that.fenzhang = false;
          } else {
            that.$message.error(res.data.message);
          }
        });
    },
    // 开通分账
    splitopen(channelTypeId, isDiv) {
      // console.log(isDiv);
      // if (isDiv != 0) return;
      splitopen({
        merchantId: this.merchantinfo.id,
        channelTypeId: channelTypeId,
        rate: this.channelrate,
      }).then((res) => {
        // console.log(res);
        if (res.data.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.data.code == 200) {
          this.$message({
            message: "开通成功",
            type: "success",
          });
          this.switchchannel = false
          this.channelrate = ''
          this.merchantdetails()
        } else {
          this.$message.error(res.data.message);
        }
      });
    },
    // 删除分账列表
    delfenzhang(id) {
      // 先找到
      const deleteIndex = this.fenzhangData.findIndex((item) => {
        return item.merchantNo === id;
      });
      // 再删除，`splice(开始下标， 删除元素数量)
      this.fenzhangData.splice(deleteIndex, 1);
    },
    //支付权限配置
    payjurisdiction() {
      paycfg(
        {
          shopRefund: this.merchantinfo.shopRefund.toString(),
          aliSwitch: this.merchantinfo.aliSwitch.toString(),
          wxSwitch: this.merchantinfo.wxSwitch.toString(),
          uniSwitch: this.merchantinfo.uniSwitch.toString(),
          aliTradeSwitch:
            this.payinfo.aliborc +
            "," +
            this.payinfo.alicorb +
            "," +
            this.payinfo.alirefund,
          wxTradeSwitch:
            this.payinfo.wxborc +
            "," +
            this.payinfo.wxcorb +
            "," +
            this.payinfo.wxrefund,
          uniTradeSwitch:
            this.payinfo.uniborc +
            "," +
            this.payinfo.unicorb +
            "," +
            this.payinfo.unirefund,
          bankTradeSwitch:
            this.payinfo.bankborc + "," + "0," + this.payinfo.bankrefund,
        },
        this.merchantinfo.id
      ).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.$message({
            message: "修改成功",
            type: "success",
          });
          this.jurisdiction = false;
          this.merchantdetails();
        } else {
          this.$message.error(res.message);
        }
      });
    },
    // 代运营申请
    operationapply() {
      let that = this;
      if (this.operationapplybtn) {
        this.operationapplybtn = false;
        const loading = this.$loading({
          lock: true,
          spinner: "el-icon-loading",
          background: "rgba(0, 0, 0, 0.7)",
        });
        operationapply({
          merchantChannelId: this.merchantinfo.aliChannelId,
          alipayAccount: this.alipayAccount,
        }).then((res) => {
          if (res.code == 200) {
            this.batchNo = res.data.batchNo;
            this.$message({
              message: "代申请成功",
              type: "success",
            });
            loading.close();
            this.threebinding = false;
            setTimeout(function () {
              that.operationapplybtn = true;
            }, 10000);
          } else {
            this.$message.error(res.message);
            loading.close();
            that.operationapplybtn = true;
          }
        });
      } else {
        this.$message({
          message: "您操作过于频繁,请稍后再试",
          type: "warning",
        });
      }
    },
    // 同步运营操作结果
    operationresult() {
      let that = this;
      if (this.operationresultbtn) {
        this.operationresultbtn = false;
        operationresult({
          merchantChannelId: this.merchantinfo.aliChannelId,
          batchNo: this.batchNo,
        }).then((res) => {
          if (res.code == 200) {
            this.$message({
              message: "同步成功",
              type: "success",
            });
            setTimeout(function () {
              that.operationresultbtn = true;
            }, 10000);
          } else {
            this.$message.error(res.message);
            this.operationresultbtn = true;
          }
        });
      } else {
        this.$message({
          message: "您操作过于频繁,请稍后再试",
          type: "warning",
        });
      }
    },
    // 同步支付宝门店信息
    syncShop() {
      let that = this;
      if (this.syncShopbtn) {
        this.syncShopbtn = false;
        syncShop({
          merchantChannelId: this.merchantinfo.aliChannelId,
        }).then((res) => {
          if (res.code == 200) {
            this.$message({
              message: "同步成功",
              type: "success",
            });
            setTimeout(function () {
              that.syncShopbtn = true;
            }, 10000);
          } else {
            this.$message.error(res.message);
            that.syncShopbtn = true;
          }
        });
      } else {
        this.$message({
          message: "您操作过于频繁,请稍后再试",
          type: "warning",
        });
      }
    },
    // 新蓝海选择场景
    newlanhaitype(val) {
      this.newlanhaiinfo.applyMcc = "";
      this.newlanhaiinfo.licImageType = "";
      if (val == 1) {
        this.mcclist = [
          { name: "餐厅、订餐服务", id: "5812" },
          { name: "快餐店", id: "5814" },
          { name: "咖啡厅、茶馆", id: "5815" },
          { name: "面包糕点", id: "5462" },
          { name: "宴会提供商", id: "5811" },
          { name: "其他食品零售", id: "5499" },
          { name: "乳制品/冷饮", id: "5451" },
          { name: "水果店", id: "5423" },
          { name: "水果糖果及坚果商店", id: "5441" },
        ];
        this.materialslist = [
          { name: "营业执照", id: "business_lic" },
          { name: "餐饮服务许可证", id: "food_service_lic" },
          { name: "食品卫生许可证", id: "food_health_lic" },
          { name: "食品经营许可证", id: "food_business_lic" },
          { name: "食品流通许可证", id: "food_circulate_lic" },
          { name: "食品生产许可证", id: "food_production_lic" },
        ];
      } else if (val == 2) {
        this.mcclist = [
          { name: "杂货店", id: "5331" },
          { name: "超市，非平台类", id: "5411" },
          { name: "肉、禽、蛋及水产品", id: "5422" },
          { name: "其他食品零售", id: "5499" },
          { name: "母婴用品", id: "5641" },
          { name: "化妆品", id: "5977" },
          { name: "烟草/雪茄", id: "5993" },
        ];
        this.materialslist = [{ name: "营业执照", id: "business_lic" }];
      }
    },
    // 监听新蓝海行业类目
    mccchange(val) {
      this.newlanhaiinfo.licImageType = "";
      if (val == "5499") {
        if (this.newlanhaiinfo.applyType == "1") {
          this.materialslist = [
            { name: "餐饮服务许可证", id: "food_service_lic" },
            { name: "食品卫生许可证", id: "food_health_lic" },
            { name: "食品经营许可证", id: "food_business_lic" },
            { name: "食品流通许可证", id: "food_circulate_lic" },
            { name: "食品生产许可证", id: "food_production_lic" },
          ];
        } else if (this.newlanhaiinfo.applyType == "2") {
          this.materialslist = [{ name: "营业执照", id: "business_lic" }];
        }
      } else if (val == "5993") {
        this.materialslist = [
          { name: "烟草专卖零售许可证", id: "tobacco_lic" },
        ];
      }
    },
    // 确定新蓝海按钮
    newlanhaiok() {
      const loading = this.$loading({
        lock: true,
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      if (this.alilanhaival == 0) {
        blueSeaapply({
          channelId: this.merchantinfo.aliChannelId,
          provinceCode: this.newlanhaiinfo.selectedOptions[0],
          cityCode: this.newlanhaiinfo.selectedOptions[1],
          countyCode: this.newlanhaiinfo.selectedOptions[2],
          ...this.newlanhaiinfo,
        }).then((res) => {
          if (res.data.code == 200) {
            loading.close();
            this.$message({
              message: res.message,
              type: "success",
            });
            this.newlanhai = false;
            this.merchantdetails();
          } else {
            loading.close();
            this.$message.error(res.message);
          }
        });
      } else if (this.alilanhaival == 4) {
        blueSeamodify({
          channelId: this.merchantinfo.aliChannelId,
          provinceCode: this.newlanhaiinfo.selectedOptions[0],
          cityCode: this.newlanhaiinfo.selectedOptions[1],
          countyCode: this.newlanhaiinfo.selectedOptions[2],
          ...this.newlanhaiinfo,
        }).then((res) => {
          if (res.data.code == 200) {
            loading.close();
            this.$message({
              message: res.message,
              type: "success",
            });
            this.merchantdetails();
          } else {
            loading.close();
            this.$message.error(res.message);
          }
        });
      }
    },
    logadings() {
      this.loadingss = this.$loading({
        lock: true,
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
    },
    pOutside(res, file) {
      // 外部门头照
      if (res.code == 405) {
        this.loadingss.close();
        sessionStorage.removeItem("token");
        this.$router.push("/login");
      } else if (res.code == 200) {
        this.loadingss.close();
        this.$message({
          message: "上传成功",
          type: "success",
        });
        this.newlanhaiinfo.outsideUrl = res.data.filePath;
      } else {
        this.loadingss.close();
        this.$message.error(res.message);
      }
    },
    pInside(res, file) {
      // 内部环境照
      if (res.code == 405) {
        this.loadingss.close();
        sessionStorage.removeItem("token");
        this.$router.push("/login");
      } else if (res.code == 200) {
        this.loadingss.close();
        this.$message({
          message: "上传成功",
          type: "success",
        });
        this.newlanhaiinfo.insideUrl = res.data.filePath;
      } else {
        this.loadingss.close();
        this.$message.error(res.message);
      }
    },
    statusphoto(res, file) {
      // 资质证明材料
      if (res.code == 405) {
        this.loadingss.close();
        sessionStorage.removeItem("token");
        this.$router.push("/login");
      } else if (res.code == 200) {
        this.loadingss.close();
        this.$message({
          message: "上传成功",
          type: "success",
        });
        this.newlanhaiinfo.licImageUrl = res.data.filePath;
      } else {
        this.loadingss.close();
        this.$message.error(res.message);
      }
    },
    // 打开新蓝海弹窗
    newlanhaibtn(id) {
      this.newlanhaiinfo = {};
      let that = this;
      this.newlanhai = true;
      if (this.alilanhaival == 4) {
        this.newlanhaidisabled = true;
      }
      blueSeaquery({
        channelId: this.merchantinfo.aliChannelId,
      }).then((res) => {
        this.newlanhaiinfo = {
          ...res.data,
          selectedOptions: [
            res.data.provinceCode,
            res.data.cityCode,
            res.data.countyCode,
          ],
        };
        if (res.data.applyType == 1) {
          this.mcclist = [
            { name: "餐厅、订餐服务", id: "5812" },
            { name: "快餐店", id: "5814" },
            { name: "咖啡厅、茶馆", id: "5815" },
            { name: "面包糕点", id: "5462" },
            { name: "宴会提供商", id: "5811" },
            { name: "其他食品零售", id: "5499" },
            { name: "乳制品/冷饮", id: "5451" },
            { name: "水果店", id: "5423" },
            { name: "水果糖果及坚果商店", id: "5441" },
          ];
          this.materialslist = [
            { name: "营业执照", id: "business_lic" },
            { name: "餐饮服务许可证", id: "food_service_lic" },
            { name: "食品卫生许可证", id: "food_health_lic" },
            { name: "食品经营许可证", id: "food_business_lic" },
            { name: "食品流通许可证", id: "food_circulate_lic" },
            { name: "食品生产许可证", id: "food_production_lic" },
          ];
        } else if (res.data.applyType == 2) {
          this.mcclist = [
            { name: "杂货店", id: "5331" },
            { name: "超市，非平台类", id: "5411" },
            { name: "肉、禽、蛋及水产品", id: "5422" },
            { name: "其他食品零售", id: "5499" },
            { name: "母婴用品", id: "5641" },
            { name: "化妆品", id: "5977" },
            { name: "烟草/雪茄", id: "5993" },
          ];
          this.materialslist = [{ name: "营业执照", id: "business_lic" }];
        }
      });
    },
    // 省市区选择
    handleChange(value) {
      // console.log(value);
    },
    
    // 测试二维码
    async qrCodeTestBtn(payType, mchNo) {
      this.payTypeTitle = payType;
      if (!this.textQrCodeId) {
        this.showQRCode = false;
        this.$message.error("商户号不能为空，请配置通道商户号");
      } else {
        this.showQRCode = true;
        this.$nextTick(async () => {
          // console.log("通道商户号：" + this.textQrCodeId);
          // console.log(this.paydeploy.mchId);
          this.$refs.qrCodeUrl.innerHTML = "";
          this.$refs.DpayCodeUrl.innerHTML = "";

          this.qrcode = new VueQRCode(this.$refs.qrCodeUrl, {
            text: process.env.VUE_APP_PAY_URL + `/h5pay/${this.textQrCodeId}/1`, // 需要转换为二维码的内容
            width: 200,
            height: 200,
            colorDark: "#000000",
            colorLight: "#ffffff",
            correctLevel: VueQRCode.CorrectLevel.H,
          });
          //  DpayCodeUrl

          const res = await merchantDpayUrl(payType, mchNo);
          if (res.code == 200) {
            this.qrcode = new VueQRCode(this.$refs.DpayCodeUrl, {
              text: res.data, // 需要转换为二维码的内容
              width: 200,
              height: 200,
              colorDark: "#000000",
              colorLight: "#ffffff",
              correctLevel: VueQRCode.CorrectLevel.H,
            });
          } else {
            this.$message.error(res.message);
          }
        });
      }
    },
    // 关闭测试二维码弹窗
    closeQrCode(done) {
      this.$confirm("确认关闭？")
        .then((_) => {
          done();
        })
        .catch((_) => {});
    },
    // 权限配置box
    jurisdictionbtn() {
      this.jurisdiction = true;
      this.merchantdetails();
    },
   
   async openBalancePayClick(){
      const valid = await this.$refs.balancePayFormRef.validate()
      if(valid){
        const res = await huifuBusiBind({balance_pay_config:JSON.stringify(this.balancePayForm), extended_material_list:JSON.stringify([{file_type:'F449',file_id:this.balancePayForm.F449Id},{file_type:'F447',file_id:this.balancePayForm.F447Id}]) , huifu_id:this.huifuConfigId})
        if(res.code == 200){
          this.$message.success('开通成功，审核中~')
        }else{
          this.$message.error(res.message)
        }
      }
    },
    wxConfiguration(v){
      this.wxConfigurationVisible = true
      this.$nextTick(() => {
          this.$refs.wxConfigurationFormRef.resetFields()
          this.wxConfigurationForm.huifu_id = v.mchId
      })
    },
    async openAliConfigClick(){
      const valid = await this.$refs.aliConfigurationFormRef.validate()
      if(valid){
        const res = await huifuBusiBind({ali_conf_list:JSON.stringify([this.aliConfigurationForm]) , huifu_id:this.huifuConfigId})
        if(res.code == 200){
          this.$message.success('开通成功，审核中~')
        }else{
          this.$message.error(res.message)
        }
      }
    },
    async openWxConfigClick(){
      const valid = await this.$refs.wxConfigurationFormRef.validate()
      if(valid){
        const res = await huifuBusiBind({ wx_conf_list:JSON.stringify([this.wxConfigurationForm]) ,  huifu_id:this.huifuConfigId })
        if(res.code == 200){
          this.$message.success('开通成功，审核中~')
        }else{
          this.$message.error(res.message)
        }
      }
    },
    async openAccountsClick(v){
      const valid = await this.$refs.accountsFormRef.validate()
      if(valid){
        if(!this.accountsForm.split_ext_info.busi_instruction){
          this.accountsForm.split_ext_info = null
        }
        this.accountsLoading = true
        const res = await huifuBusiBind({split_conf_info:this.accountsForm,huifu_id:this.accountsForm.huifu_id})
        if(res.code == 200){
          this.accountsLoading = false
          this.$message.success('开通成功，审核中~')
          this.openAccountsVisible = false
          this.accountsForm.split_ext_info = {
            busi_instruction:'',
            capital_instruction:'',
            function_instruction:''
          }
        }else{
          this.accountsLoading = false
          this.$message.error(res.message)
          this.accountsForm.split_ext_info = {
            busi_instruction:'',
            capital_instruction:'',
            function_instruction:''
          }
        }
      }
      
    },
    jumpChannel(id) {
      this.$router.push({ path: "/channelcustom" });
      sessionStorage.setItem("channel", JSON.stringify(id));
    },
    // 定制属性修改窗口
    popupCustProp(title) {
      this.updCustPropTitle = title;
      this.custProp = true;
      this.oldMerInfo.alias = this.merchantinfo.alias;
    },
    // 定制属性修改检测
    updMerCustCheck() {
      let updActive = false;
      if (this.merchantinfo.alias != this.oldMerInfo.alias) {
        updActive = true;
      }
      if (updActive) {
        this.updMerCustFlag = false;
      } else {
        this.updMerCustFlag = true;
      }
    },
    // 修改定制属性
    updMerCustProp() {
      let updFlag = false;
      let custMer = {
        id: this.merchantinfo.id,
      };
      let loading = this.$loading({
        lock: true,
        text: "Loading",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      if (this.merchantinfo.alias != this.oldMerInfo.alias) {
        updFlag = true;
        custMer.alias = this.merchantinfo.alias;
      }
      if (updFlag) {
        updMerCustProp(custMer).then((res) => {
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            this.merchantdetails();
            this.custProp = false;
            this.oldMerInfo = {};
            this.updMerCustFlag = true;
            this.$message.success(res.message);
          } else {
            this.$message.error(res.message);
          }
          loading.close();
        });
      }
    },
    // 开通商户流量包项目
    popupMerPoint() {
      this.merPoint = true;
    },
    openMerPoint() {
      if (
        this.addMerPoint.limitRatio == null ||
        this.addMerPoint.limitRatio.match(/\D/g)
      ) {
        this.$message.error("积分充值比例必须为整数");
        return;
      }
      if (
        this.addMerPoint.limitMul == null ||
        !this.addMerPoint.limitMul.match("^[0-9]+(.[0-9]{1,2})?$")
      ) {
        this.$message.error("积分充值系数格式错误");
        return;
      }
      if (
        this.addMerPoint.warnValue == null ||
        this.addMerPoint.warnValue.match(/\D/g)
      ) {
        this.$message.error("积分预警阈值必须为整数");
        return;
      }
      let loading = this.$loading({
        lock: true,
        text: "Loading",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      openMerPoint({
        merchantId: this.merchantinfo.id,
        limitRatio: this.addMerPoint.limitRatio,
        limitMul: this.addMerPoint.limitMul,
        warnValue: this.addMerPoint.warnValue,
        warnMail: this.addMerPoint.warnMail,
      }).then((res) => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.merPoint = false;
          this.addMerPoint = {};
          this.$message.success("开通成功！");
          this.merchantinfo.pointId = res.data.id;
          this.$router.push({
            path: "/merPoint",
            query: { merPointId: res.data.id },
          });
        } else {
          this.$message.error(res.message);
        }
        loading.close();
      });
    },
    jumpMerPoint(id) {
      this.$router.push({ path: "/merPoint", query: { merPointId: id } });
    },
    // 开通单品优惠券
    openCoupon() {},
  },
};
</script>

<style scoped lang="less">
.title {
  background: #fff;
  padding: 10px;
  font-size: 18px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
}

.container {
  width: 100%;
  display: flex;
  margin-bottom: 20px;
  box-sizing: border-box;
  flex-wrap: wrap;
  .itemBox {
    width: 50%;
    .line {
      width: 100%;
      display: flex;
      font-size: 12px;
      line-height: 200%;
      div:nth-child(1) {
        width: 30%;
        text-align: left;
      }
      div:nth-child(2) {
        width: 70%;
        text-align: left;
        color: #888888;
      }
    }
  }
  .payBox {
    width: 100%;
    .thead {
      border-bottom: 1px solid #dddddd;
      display: flex;
      padding: 15px 0;
      span {
        width: 25%;
        text-align: center;
        display: inline-block;
      }
    }
  }
  .tbody {
    display: flex;
    padding: 15px 0;
    div {
      width: 25%;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: center;
      font-size: 12px;
    }
  }
}

.channel {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
}

.channel .cBox {
  width: 14.8%;
  margin-right: 25px;
  margin-bottom: 25px;
}

.channel .cBox .channelitem {
  width: 100%;
  border: 1px solid #e9e9e9;
  border-radius: 8px;
  position: relative;
  padding: 20px 0;
  box-shadow: 5px 5px 5px #e9e9e9;
  &:hover {
    transform: scale(1.1);
  }
  .custom {
    position: absolute;
    bottom: 0;
    left: 0;
    text-align: center;
    color: #fff;
    padding-top: 17px;
    border-style: solid;
    border-width: 0px 80px 80px 0px;
    border-color: transparent transparent #00a1ff transparent;
    width: 0px;
    height: 0px;
    // border-bottom-left-radius: 5px;
    cursor: pointer;
    span {
      position: absolute;
      top: 65px;
      font-size: 12px;
      width: 42px;
    }
  }
}

.channel .cBox .channelitem .line {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  margin: 10px 0;
  margin-top: 20px;
}

.delBtn {
  position: absolute;
  left: 5px;
  top: 5px;
}

.lines {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  height: 50px;
  .btn {
    div {
      color: #01aaef;
      border: 1px solid #01aaef;
      font-size: 12px;
      padding: 3px 6px;
      cursor: pointer;
    }
  }
}

.channel .cBox .channelitem .line img {
  width: 45px;
  height: 45px;
  margin-right: 10px;
  margin-bottom: 50px;
}

.channel .cBox .channelitem .state {
  position: absolute;
  top: 0;
  right: 0;
  text-align: center;
  color: #000;
  background: url(../../assets/img/pass.png) no-repeat;
  background-size: 100%;
  width: 80px;
  height: 80px;
  color: #fff;
  padding-top: 17px;
  span {
    margin-left: 25px;
    font-size: 12px;
  }
}

.channel .cBox .channelitem {
  .rejected {
    position: absolute;
    top: 0;
    right: 0;
    text-align: center;
    color: #000;
    background: url(../../assets/img/rejected.png) no-repeat;
    background-size: 100%;
    width: 80px;
    height: 80px;
    color: #fff;
    padding-top: 17px;
    span {
      margin-left: 25px;
      font-size: 12px;
    }
  }
  .passjia {
    position: absolute;
    top: 0;
    right: 0;
    text-align: center;
    color: #000;
    background: url(../../assets/img/passjia.png) no-repeat;
    background-size: 100%;
    width: 80px;
    height: 80px;
    color: #fff;
    padding-top: 17px;
    span {
      margin-left: 25px;
      font-size: 12px;
    }
  }
  .review {
    position: absolute;
    top: 0;
    right: 0;
    text-align: center;
    color: #000;
    background: url(../../assets/img/review.png) no-repeat;
    background-size: 100%;
    width: 80px;
    height: 80px;
    color: #fff;
    padding-top: 17px;
    cursor: pointer;
    span {
      margin-left: 25px;
      font-size: 12px;
    }
  }
}

.channel .cBox .tip {
  width: 100%;
  height: 70px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin-top: 10px;
}

.channel .cBox .tip span {
  display: inline-block;
  width: 100%;
  text-align: center;
}

.el-icon-sort {
  color: #01aaef;
  font-size: 20px;
  -moz-transform: rotate(-90deg);
  -webkit-transform: rotate(-90deg);
  margin-left: 10px;
  font-weight: 600;
}

.tbodystate {
  background: #f0f0f0;
  color: #ff9800;
  margin-left: 10px;
  padding: 5px;
}

.project {
  width: 10%;
}

.project .projectitem {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
}

.project .tip {
  width: 100%;
  text-align: center;
  margin-top: 10px;
}

.bule {
  color: #00152a;
  text-decoration: underline;
  cursor: pointer;
}

.operbtn {
  color: #00152a;
  text-decoration: underline;
  cursor: pointer;
  text-align: center;

}

.error span {
  background: #f0f0f0;
  color: #f9607d;
}

.error {
  color: #f9607d;
  cursor: pointer;
}

.red {
  color: red;
  text-decoration: underline;
}

.reds {
  color: red;
  font-size: 20px;
  width: 100%;
  padding: 5px 15px;
  text-align: left;
}

.blueBtn {
  background: #3794ec;
  color: #fff;
  padding: 3px 20px;
  border-radius: 30px;
  cursor: pointer;
}

.open {
  color: #92cd92;
}

.flex {
  width: 100%;
  margin-top: 20px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.urllist {
  width: 60%;
  margin: 0 auto;
}

.itemtit {
  font-size: 12px;
  font-weight: 600;
  margin-right: 30px;
}

.alibox {
  width: 100%;
  // padding: 0 10%;
  margin-top: 25px;
}

#qrcode img {
  width: 200px;
  height: 200px;
}

.servicelevel {
  width: 100%;
}

.servicelevels {
  width: 97%;
}

.wid50 {
  width: 60% !important;
}

.head {
  cursor: pointer;
}

.signingcode {
  width: 100%;
  text-align: center;
}

.el_tag {
  margin-right: 10px;
  margin-bottom: 5px;
}

.border {
  border-top: 1px solid #eeeeee;
  margin-top: 5px;
}

.pay-form-inline {
  margin-bottom: 8px;
}

.width100 {
  width: 95%;
}

.photo {
  width: 50%;
  display: inline-block;
}
.tableBox {
  width: 100%;
}
/deep/.el-dialog {
  top: 1% !important;
  left: 0 !important;
}
.channel-info .thead {
  display: flex;
  width: 100%;
  border-bottom: 1px solid #dddddd;
  padding: 15px 0;
}
.channel-info .thead span {
  width: 25%;
  text-align: center;
  display: inline-block;
}
.channel-info .tbody {
  display: flex;
  width: 100%;
}
.codes {
  display: flex;
  align-items: center;
  .DpayCode {
    margin-left: 50px;
  }
}
.code-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  p {
    text-align: center;
    display: inline-block;
    width: 200px;
    font-size: 20px;
    margin-bottom: 18px;
    margin-top: -10px;
  }
}
.clearfix {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
::v-deep .el-descriptions-item__label:not(.is-bordered-label) {
  font-size: 14px;
  color: #4e5969;
}
::v-deep .el-descriptions-item__container .el-descriptions-item__content {
  color: #1d2129;
  font-size: 14px;
}
.open-accounts{
  max-height:60vh;
  overflow-y:auto;
}
.open-accounts::-webkit-scrollbar{
         display:none;
    }

    .avatar{
    width: 126px;
    height: 102px;
  }
.avatar-none{
    width: 126px;
    height: 102px;
}
::v-deep .el-upload--text{
    width: 126px !important;
    height: 102px !important;
    line-height: 102px !important;
}
</style>
